[Top][All Lists]

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

Re: {PATCH] continuous scroll for doc-view (FOR REVIEW))

From: dalanicolai
Subject: Re: {PATCH] continuous scroll for doc-view (FOR REVIEW))
Date: Thu, 13 Jan 2022 12:08:27 +0100

Actually, I am not sure where I will focus on next. I think in pdf-tools, the scaling part is already correctly taken
care of without extra work (while fixing that would probably take me a lot of time in doc-view). Also, I have
mailed the current maintainer about merging pdf-tools into Emacs, and he is certainly willing to do that
(and try to get Andread Politza, its original developer, to sign the papers). So, I think that I will/should focus
now again on trying to get this working, fully, in pdf-tools (and see this as a helpful exercise, pdf-tools for
sure is partly based on doc-view code).

On Thu, 13 Jan 2022 at 11:58, dalanicolai <dalanicolai@gmail.com> wrote:
I have more or less no experiences with patches, so I hope you don't mind that I am just quickly ask here;
so are (or can be) these kind of 'subcommits' and their commit messages part of some final patch. Or is
there some other way to handle it?

On Thu, 13 Jan 2022 at 11:53, dalanicolai <dalanicolai@gmail.com> wrote:
I am not sure how to best handle this, but I figured I'll better keep you
involved (get feedback better sooner than later).

So I have got the code for a first 'working' example for the continuous scroll.

Let me comment a little first:
So I've started from the Proof of Concept here, on which I commented
on more already in the thread here (original thread is here).

A very short, but 'noteworthy' digression ...

I'd really like to mention that I get no hits when searching for that thread (actually searching
for 'the original thread') when searching on `multi image PDF` in the Emacs devel archive.
(This time) it is not due to too many results. Would be great if you could inform me why that
does not work.

Back to the main subject...

So I will attach two files here, the first is an 'adapted' bookroll.el file, and the second is a
a modified doc-view file that implements the first 'rudimentary' continuous scroll for PDF
documents(despite the subject title of this message, I am simply attaching the file,
as you can then more simply load and try it, while I guess you must be capable of diffing it with
the latest doc-view.el file yourself ;).
For, now it only works on PDF documents (I hope all of them), because I
have to find good 'splitting points' for the various overlays (this was the original approach
that I'd used in pdf-view, I prefer to keep the document it's contents in the buffer and drawing
the overlays over it). For other types of documents I've tried to 'determine' split points using `forward-line`, but that did not give satisfactory results.

I am not sure if the bookroll-mode should be a separate package (like image-mode),
or that it could just get merged into doc-view. But it is as it is for the development process.

So now some comments on the files/approach:

To understand the approach of bookmark.el, it is probably most useful to look at the Proof
of Concept file to which I have linked already above. It simply draws a triplet of images (pages)
for each page (and a doublet for the first and last pages), and then it uses a 'currently-displayed-images' list, and refreshes pages when necessary by comparing with that list. The current page is the page that takes more than half of the window height.

In the single page doc-view there is a single overlay, that informs via its properties many doc-view functions about which step to take next (it controls the doc-view 'process'). In the bookroll
doc-view version, This overlay is kept as a 'control' overlay, which is not used for containing images. The overlays for 'holding' the images are in the `overlay-list`. (Although this solution
for the control overlay looks simple, it took me quite some investigation and error and trial to
come up with it, which is also to say that I think it is a nice solution).

For now, the scrolling is too continuous (i.e. now separation indicator between the pages), but I
am planning to embed the files in svg images (as I have done in djvu3.el), so that it will be easy
to draw a line between the pages

So, anyone who is interested can have a look at the code, and of course any feedback and suggestions are welcome I am no experienced programmer, and I am also fairly new to Emacs
(actually Spacemacs which I think is (also) a really great project). I am only able to do this because of your great (documentation) work :) If you find things that looks like 'bad developing
process practice', then I am very happy with good/better suggestions.

As I have to take care of 'fixing' the 'resizing/scaling/zoom' functionality now, any comments
ideas on that part would be welcome in particular...

Quite obviously, to test it, load the bookmark.el file, then load the doc-view.el file, open some PDF document and start scrolling using `j`/`k`.

reply via email to

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