unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: dalanicolai <dalanicolai@gmail.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: {PATCH] continuous scroll for doc-view (FOR REVIEW))
Date: Thu, 13 Jan 2022 12:08:27 +0100	[thread overview]
Message-ID: <CACJP=3=1hOJb1=WstkuWxDkRDdFWrJ+Ad9MOf6DKdb_Nm5SoyQ@mail.gmail.com> (raw)
In-Reply-To: <CACJP=3=Ci_RB6qmjwxcND+myg7M9PFdR5iq1EdBJnknWdRwDzg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5426 bytes --]

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
>> <https://github.com/dalanicolai/bookroll.el>, on which I commented
>> on more already in the thread here
>> <https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00663.html>
>> (original thread is here
>> <https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00938.html>).
>>
>>
>> A very short, but 'noteworthy' digression ...
>>
>> I'd really like to mention that I get no hits when searching for that
>> thread
>> <https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=Multi+image+PDF&submit=Search%21&idxname=emacs-devel&max=20&result=normal&sort=score>
>> (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
>> <https://github.com/dalanicolai/djvu3>), 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`.
>>
>

[-- Attachment #2: Type: text/html, Size: 6807 bytes --]

  reply	other threads:[~2022-01-13 11:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 10:53 {PATCH] continuous scroll for doc-view (FOR REVIEW)) dalanicolai
2022-01-13 10:58 ` dalanicolai
2022-01-13 11:08   ` dalanicolai [this message]
2022-01-14  8:03 ` Juri Linkov
2022-01-14 10:44   ` dalanicolai
2022-01-14 11:03     ` dalanicolai
2022-01-15 18:09       ` dalanicolai
2022-01-15 18:13     ` Juri Linkov
2022-01-16 22:07       ` dalanicolai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACJP=3=1hOJb1=WstkuWxDkRDdFWrJ+Ad9MOf6DKdb_Nm5SoyQ@mail.gmail.com' \
    --to=dalanicolai@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).