-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upstream pdf roll #224
base: master
Are you sure you want to change the base?
Upstream pdf roll #224
Conversation
Hey @aikrahguzar , Thank you for opening the draft. My plan is to review and merge #188 and #39 first, followed by #29 and #113 if they still make sense (I am not sure right now as I will need to read through all the code and the places that are impacted in the After that, you can maybe rebase your changes on top of that work and we can then revisit this. I will update this thread once the listed PRs are merged into Thanks, |
That plan is good for me, thanks a lot! This change set is quite a big so I think it will take some time to review too but hopefully some people try it in the meanwhile to surface potential issues. I was use the minor mode that will be added in #39 but stopped using it before I worked on this. I imagine the interaction of the two features will not be totally smooth and some changes similar to the one is text-selection code will need to be made. But it is better to wait for #39 to merge before making those changes. |
Data point: I tried it like so:
Also, |
Thanks for testing.
I think this should be fixed now. Please let me know if it isn't.
Can you explain more? When I use isearch it searches all visible pages. |
Tested it again with the latest emacs-29 branch:
This works now; but I have an apology to make: apparently I was running
Right now, for me, when not in (Some detail on my methodology - in case anyone else wants to try: The loading of |
I think those remappings were needed but I am confused that you got the backtrace you showed with
Thanks for explaining. I think I fixed both the problems. isearch should work regardless of mode and search should continue to next pages. Please test and report back. |
Oh, OK. I assumed so because I did not switch branches after cloning.
Yes, great! Things work well now. One additional minor issue is that cancelling an isearch started from a point at the middle of a page returns it to the top of the page. |
Is this only with this branch or also with the current released version of
Thanks! |
Hmm, I guess it's nothing new. Another bug I encountered: Open the pdf; activate the minor mode; scroll down using
|
That is an |
I have gone ahead and combined the content of Everything is working for me on initial testing and hopefully I will for others too. |
Hi @aikrahguzar, thanks for your amazing work on this feature! I've been testing your branch on emacs 28 on Linux and emacs 29 on macOS, and things are looking good so far. The only issue I've encountered is with scrolling. On Linux with emacs 28, the mouse wheel scrolling seems to be very slow, perhaps moving only one pixel at a time. It's very smooth, but it takes a lot of spinning the mouse wheel to scroll an appreciable amount. Scrolling using the keyboard arrow keys works fine. On macOS with emacs 29, the scrolling is fine with Let me know how if I can help debug. EDIT: With |
I am on Emacs 29 and linux and scrolling works for me so probably generation of mouse events changed in some way. Can you scroll for roughly the same time on Emacs 28 and Emacs 29 and compare with shows up in (defun pdf-roll-scroll-mouse-wheel (event)
"Scroll according to mouse wheel EVENT."
(interactive "e")
(with-selected-window (posn-window (event-start event))
(pcase (event-basic-type event)
('wheel-down (pdf-roll-scroll-forward))
('wheel-up (pdf-roll-scroll-backward))
(_ (error "Event must be wheel down or wheel up event"))))) so slow scrolling probably means that somehow Emacs 28 is generating less
Edit: I tried the idea above (replacing |
Actually, I think removing bindings for (keymap-set pdf-view-roll-minor-mode-map "<wheel-up>" nil)
(keymap-set pdf-view-roll-minor-mode-map "<wheel-down>" nil) (I think this particular snippet needs compat on Emacs 28). Let know if it works. |
c24aed4
to
7656327
Compare
Thank @aikrahguzar for your help! Unfortunately, removing the bindings didn't help, and I see that you've removed all the scrolling functionality anyway in your latest commits. After a little investigation, I think the problem is that |
You are right, I removed the scrolling functionality because I am trying to get @roshanshariff , yesterday I realized that even though I had fixed the region to appear on the correct page, it still always applied to the first page visible. I think it is correct now but if you can test annotations/ |
e2b1b94
to
d63e729
Compare
Very nice @aikrahguzar, your recent commit with the line-to-pixel conversion has fixed mouse wheel scrolling! I can also confirm that dragging with the mouse to select a region works and displays a highlight on the correct page (if that's what you meant) and |
Thanks for testing! Can you also test annotations e.g. |
Looks like highlight annotations are also working, even on the second visible page on the screen 👍 |
@roshanshariff I think |
To people who want to have (add-hook 'pdf-view-roll-minor-mode-hook
(defun +pdf-roll-adjust-precision-scroll ()
(if pdf-view-roll-minor-mode
(progn (kill-local-variable 'pixel-scroll-precision-mode)
(kill-local-variable 'mwheel-coalesce-scroll-events))
(setq-local pixel-scroll-precision-mode nil)
(setq-local mwheel-coalesce-scroll-events t)))) this is because stock Edit: Not necessary anymore since |
I can confirm I did find that |
This used to work so it was me messing something up during recent changes and it did turn out to be trying to slice an already slice image. Should be fixed now. In general I would like to make every feature that can reasonably to work with continuous display of pages to work. Most of the changes required are fairly straightforward: look for where |
Thanks for all the work! Just a nit: with the latest commit, |
I missed changing the interactive spec before and because of evil I wasn't calling |
Hi @aikrahguzar, just a head's up: your last commit (I'm guessing accidentally) moved the autoload cookie from before the definition of |
Thanks @roshanshariff , should be fixed now. |
pdf-roll now contains both their contents. All image-roll-* symbols are now pdf-roll-* symbols
This changes the format of pdf-view-active-region to (cons page list-of-edges). The page number is needed since when multiple pages are displayed the active region is not necessarily on current page.
This affects bookmarks made when buffer is not displayed. It also affects save-place-pdf-view.
Also be sparing in use of `pos-visible-in-window-p`, it seems to cause a lot of allocations.
This is needed to make scrolling work even when the pdf window is not selected.
Due to pervasive nature of changes the variable needs to be consulted at multiple places this streamlines that. Also use context-pixels if used in required-vscroll
The intended behavior is: the last page should occupy at least half the window and scrolling past that shouldn't work
`pdf-view-roll-minor-mode` needs to be reinitialized about reverting, so we add a function to revert-buffer-function. Previously it was `pdf-view-roll-minor-mode` itself but that didn't not have the write calling convention and caused errors.
This prevents errors when the buffer is not visiting a file and doesn't seem to cause any problems with normal functionality but might need to be revisited. Also pass window to a call of assert-pdf-window. Lastly, clear displayed pages with initializing mode.
This removes jankiness when scrolling
ee0939a
to
009e9c9
Compare
Thanks a lot! I did that with the help of magit. Seems to have worked! |
Didn't realise it's been a year! Just wanted to ask if the PR is still a WIP or is awaiting review from the package maintainer? Thanks! |
Awaiting a review. |
Hi, @vedang,
I am opening this (as a draft) to have some concrete starting point for merging support for displaying multiple pages simultaneously.
It is a draft because because some things need to be sorted out,
Currently this requires my fork of image-roll. Since @dalanicolai wants to focus on other projects and for me image-roll is just a means to an end, I think it would be better to importI went ahead and added theimage-roll.el
intopdf-roll.el
. This mostly requires changing the prefix for functions and it pretty mechanical but I wanted to get yours and @dalanicolai's feedback about this. To me it seems like the best thing to do since it simplifies the life of users since they don't have to install a dependency and the file itself is around 400 lines long currently so not a very large addition especially for a project of the size ofpdf-tools
.image-roll
code directly to thepdf-roll.el
so now no external package is needed.What strategy should be used to convey that the feature is experimental and might not interact well with every feature currently available? I prefer a message when
pdf-view-roll-minor-mode
is enabled. But I am fine with the suggestion of a flag suggested in New package image-roll (continuous-scroll) #104One possible degradation in performance I know of is the loss of caching in
pdf-links-read-link-action
since with multiple pages displayed the labels depend on the position of a page among displayed pages. I think the current behavior can be preserved whenpdf-view-roll-minor-mode
is not used by caching only the first displayed page. The result will be messy but it is doable.This also introduces some backward incompatibility since we need to track which page is involved for operations, e.g.
pdf-view-active-region
now has a different format which includes the page on which the region exists. Similarly isearch results also include information about the page. These changes are not user visible when usingpdf-tools
as an application but they do change some api.Mostly feedback is needed from people to know what breaks. The parts I use work fine but I can't say that will be the case for everyone.
Also this PR includes #29, #113, #188 because it was too difficult for me to remove those changes from among much larger changes.
P.S. I will be travelling starting Friday and will be without my laptop and access to non-work email so I will get back to whatever discussion happens only in August.
Thanks for maintaining
pdf-tools
.