[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Continuous image scrolling

From: Juri Linkov
Subject: Re: Continuous image scrolling
Date: Tue, 03 Apr 2018 22:59:43 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> I just realized we already have continuous image scrolling mode:
>> 1. visiting a PDF file generates PNG images in the temporary directory
>> 2. C-x d /tmp/docview1000/... RET
>> 3. M-x iimage-mode RET
>> 4. enjoy continuous image scrolling mode directly in dired
>>    (the same logic could be later incorporated into doc-view.el)
>> I tried this with a directory containing ca 1000 pages/images
>> and there is no performance degradation while continuously scrolling
>> all these 1000 images.
> PDF-Tools (which is vastly superior to the built-in PDF viewer) does not
> work this way. It generates pages on demand. It is an absurd waste of
> resources to visit a book and generate one png file for each page.
> PDF-Tools solves this and does much more.
> So, if the solution depends on having pre-generated images, it is worse
> than not having continuous scroll, IMAO.

This is an optimization, but a significant one, indeed,
if you are not going to read the whole PDF at once.

> OTOH, I tried what you suggest on a directory with lots of images. The
> result is quite crude. For example, it seems that the curso height
> corresponds to the image height,

It's possible to hide the cursor like we do in image-mode.

> i.e. it is not possible to finely scroll the sequence of images up and
> down, you go one image at the time.

It's because next-line goes to the next file in Dired by default,
this is why I disabled this inconvenience in my ~/.emacs by using
normal cursor motion keybindings:

  (define-key dired-mode-map [remap next-line] nil)
  (define-key dired-mode-map [remap previous-line] nil)

> The problems I faced while trying to implement continous document scroll
> for PDF-Tools revolved around making the scroll actually continous: if
> you scroll down from page P-1 to page P, remove page P-2

I see no need to remove page P-2.  For optimization it's better to keep it,
so that when the user returns to that page, it's already here.

> and append page P+1 without producing visible jumps.

Based on the simplistic approach like used by iimage-mode,
it should be easy to insert placeholders for all pages,
and use font-lock machinery to replace placeholders with
generated images when the user navigates to other parts
of the PDF buffer.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]