Giter Site home page Giter Site logo

Comments (11)

politza avatar politza commented on August 22, 2024 9

https://gist.github.com/politza/3f46785742e6e12ba0d1a849f853d0b9#file-scroll-other-window-el

from pdf-tools.

WorldsEndless avatar WorldsEndless commented on August 22, 2024 2

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

from pdf-tools.

jagrg avatar jagrg commented on August 22, 2024 1

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))))

from pdf-tools.

holtzermann17 avatar holtzermann17 commented on August 22, 2024 1

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)

from pdf-tools.

politza avatar politza commented on August 22, 2024

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.

from pdf-tools.

WorldsEndless avatar WorldsEndless commented on August 22, 2024

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?

from pdf-tools.

politza avatar politza commented on August 22, 2024

"Tory S. Anderson" [email protected] 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'.

from pdf-tools.

politza avatar politza commented on August 22, 2024

"Tory S. Anderson" [email protected] 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 ?

from pdf-tools.

WorldsEndless avatar WorldsEndless commented on August 22, 2024

Where/how is feature-request for emacs done?

from pdf-tools.

politza avatar politza commented on August 22, 2024

"Tory S. Anderson" [email protected] writes:

Where/how is feature-request for emacs done?

M-x report-emacs-bug RET

from pdf-tools.

WorldsEndless avatar WorldsEndless commented on August 22, 2024

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?

from pdf-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.