Skip to content
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

scroll-other-window doesn't work #55

Closed
WorldsEndless opened this issue Mar 1, 2015 · 11 comments
Closed

scroll-other-window doesn't work #55

WorldsEndless opened this issue Mar 1, 2015 · 11 comments

Comments

@WorldsEndless
Copy link

@WorldsEndless WorldsEndless commented Mar 1, 2015

When reading the PDF below and writing above, found that scroll-other-window (C-M-v) will scroll down to the end of the page and then, rather than going to the next page, will just bounce to the top of the same page again.

@politza
Copy link
Owner

@politza politza commented Mar 1, 2015

That's a matter of scroll-other-window not being configurable which function it should use to scroll the window, i.e. it always calls window_scroll, a C function. Similar problem occurs when the other window displays a info node.

Loading

@politza politza closed this Mar 3, 2015
@WorldsEndless
Copy link
Author

@WorldsEndless WorldsEndless commented Mar 26, 2015

I believe this should still be possible. My approach is as follows:
Rebind C-M-v to a function that checks to see if other-window-for-scrolling is PDFView mode and then use the appropriate scroll function, or use the regular scroll-other-window.

However, I can't find a way to get PDFView's mode; I've tried (derived-mode-p) but PDFView doesn't seem to derive, and there seems to be no function like (doc-view-mode-p) for PDFView mode. Do you have any suggestions on moving forward on this?

Loading

@politza
Copy link
Owner

@politza politza commented Mar 26, 2015

"Tory S. Anderson" notifications@github.com writes:

I believe this should still be possible.

Sure, but it should not be fixed in pdf-tools. Maybe you want to open
a (Emacs) feature request / bug-report.

However, I can't find a way to get PDFView's mode; I've tried
(derived-mode-p) but PDFView doesn't seem to derive [...]

That should be fixed sometime. You can use pdf-util-pdf-buffer-p' or pdf-util-pdf-window-p'.

Loading

@WorldsEndless
Copy link
Author

@WorldsEndless WorldsEndless commented Mar 31, 2015

That this should not be done in PDF-Tools and that the scroll-other-window functions need to be improved is true, but this functionality is simply too useful for me to pass up, so I'm sharing the code I wrote to achieve this (I spend a lot of my time studying PDFs and taking notes in an adjoining window), which also works for other-window scrolling in info mode and any other mode you care to specify. Hopefully it will be useful to others.

http://www.toryanderson.com/files/pdf-other-window.el

Loading

@politza
Copy link
Owner

@politza politza commented Mar 31, 2015

"Tory S. Anderson" notifications@github.com writes:

That this should not be done in PDF-Tools and that the
scroll-other-window functions need to be improved is true, but this
functionality is simply too useful for me to pass up,[...]

Why don't you open a feature-request for Emacs ?

Loading

@WorldsEndless
Copy link
Author

@WorldsEndless WorldsEndless commented Mar 31, 2015

Where/how is feature-request for emacs done?

Loading

@politza
Copy link
Owner

@politza politza commented Mar 31, 2015

"Tory S. Anderson" notifications@github.com writes:

Where/how is feature-request for emacs done?

M-x report-emacs-bug RET

Loading

@WorldsEndless
Copy link
Author

@WorldsEndless WorldsEndless commented Apr 9, 2015

Using the function I made I see some curious behavior that I can't understand. Scrolling down from the other window works as expected, however, scrolling up makes invisible changes UNLESS a) I switch to the buffer, which causes it to update and show me where it is now (after however many scroll-ups I've done), or b) a page-break has occurred, when it shows me the correct other-window regardless. This behavior doesn't seem to occur with scroll-down, which displays every time. Any idea why this would be? is there some difference in implementation of scroll up vs. scroll down?

Loading

@jagrg
Copy link

@jagrg jagrg commented Jul 2, 2016

Here's a fix that works for me in case anyone needs it.

(defun my/scroll-other-window ()
  (interactive)
  (let* ((wind (other-window-for-scrolling))
         (mode (with-selected-window wind major-mode)))
    (if (eq mode 'pdf-view-mode)
        (with-selected-window wind
      (pdf-view-next-line-or-next-page 2))
      (scroll-other-window 2))))

(defun my/scroll-other-window-down ()
  (interactive)
  (let* ((wind (other-window-for-scrolling))
         (mode (with-selected-window wind major-mode)))
    (if (eq mode 'pdf-view-mode)
    (with-selected-window wind
      (progn
        (pdf-view-previous-line-or-previous-page 2)
        (other-window 1)))
      (scroll-other-window-down 2))))

Loading

@politza
Copy link
Owner

@politza politza commented Jul 3, 2016

Loading

@holtzermann17
Copy link

@holtzermann17 holtzermann17 commented May 23, 2021

I've found that the Gist posted by @politza works for my use case; I wanted to post this code with a couple other steps that I needed to polish off the integration, hoping this saves someone else some time:

(require 'scroll-other-window)
(add-hook 'org-noter-notes-mode-hook #'sow-mode)
(setq org-noter--inhibit-location-change-handler t)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants