From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.devel Subject: Re: {PATCH] continuous scroll for doc-view (FOR REVIEW)) Date: Thu, 13 Jan 2022 12:08:27 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000052553f05d574b564" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27835"; mail-complaints-to="usenet@ciao.gmane.io" To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 13 12:09:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7xz6-000778-CN for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Jan 2022 12:09:36 +0100 Original-Received: from localhost ([::1]:45070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7xz4-00073E-T7 for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Jan 2022 06:09:34 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7xyD-0006NQ-Rl for emacs-devel@gnu.org; Thu, 13 Jan 2022 06:08:41 -0500 Original-Received: from [2607:f8b0:4864:20::a34] (port=35791 helo=mail-vk1-xa34.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7xyB-00069S-Lr for emacs-devel@gnu.org; Thu, 13 Jan 2022 06:08:41 -0500 Original-Received: by mail-vk1-xa34.google.com with SMTP id 19so3568014vkl.2 for ; Thu, 13 Jan 2022 03:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=SmC5esdPBFri1BW33tbXasHhCgzcEzSYj8Wv7ov6jcM=; b=LsIQ2NtJWTk40lT27kSV6iknKzLQLEQhn/ZpaNDCV/5KRxSdjnvHexaa+qLVYIYQOm Iqr2/fi0TmUkN6r1Yl50BAPhQsHYZPthSXtYRWIKDymHxzBtJk5wuCHHwpwxQI3aVJRF OEJwUlogZns8ANvZK7L6L/GBiKg0XjJBz1gWXmIKNPBjKECt0DlzbLx7VvYt+QYndcGN NpVLuEAagFIOlnufaMPMROwgzdoZhfvB3MM6MtjyxSemyO078byPsAKqt+raNboRTtBS 0aDavE+Zoeni+pvAdmLOSsRl1280sfYpQSweNC83LcAb3qhrj8WcnUlWj6rNvXP1tP3D nYkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=SmC5esdPBFri1BW33tbXasHhCgzcEzSYj8Wv7ov6jcM=; b=okpg6rssv3MZodtmvKSJC4R3Wu/jpoVWuOI49CdBd54Z8o0XOP2uUeItUXfCLjcvF7 7CWJ9oF27vJRMIebt88qpKrxfgpD71XbnDyWp7Nb8/G/lWthdm1kFeRRooFw50dDnbGz fiyB9UHvM0r69u8LfvucmAlk3v7RB5Pl1hYNSqjeFS/cGCK7ZQlkjrmhkSjSkJFYTkzr FxGsTlHcXYSdmbtOx1TyhoORwMyKF7qRApdWv3oGDGRzdc7waZGGqppkV+I0TOo+hMgg qSEr2HBYA93rZd85o21leaRc1KoHkt5cEloNXwk1lkVgS1HTD/pBFqfktzuzKysNFpTt 3nlg== X-Gm-Message-State: AOAM531k9MZxu3cjOb9hoMZcWgEYglWEDAfJsvyZ+OL4vY7tO/SeL9VY LzPBt9S8v2PACZanrtwNjlSomUz9k9ogrtVLDSG9jYRF X-Google-Smtp-Source: ABdhPJx13QsCbY+DGzBp0042MAH+vsEvs+ghOSThZyX0N+JtQktbkOBzJr4YHjsY0dckCpoLqlnVcsKfqvm2chddw/Q= X-Received: by 2002:a05:6122:92a:: with SMTP id j42mr1843057vka.41.1642072118546; Thu, 13 Jan 2022 03:08:38 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::a34 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::a34; envelope-from=dalanicolai@gmail.com; helo=mail-vk1-xa34.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284702 Archived-At: --00000000000052553f05d574b564 Content-Type: text/plain; charset="UTF-8" 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 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 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`. >> > --00000000000052553f05d574b564 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 maintaine= r about merging pdf-tools into Emacs, and he is certainly willing to do tha= t
(and try to get Andread Politza, its original developer, to si= gn the papers). So, I think that I will/should focus
now again o= n trying to get this working, fully, in pdf-tools (and see this as a helpfu= l 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 mor= e 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 's= ubcommits' 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 (ge= t feedback better sooner than later).

So I have go= t 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 (origi= nal thread is here).


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

I'd really like to mention that I get no hits whe= n searching for that th= read (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 i= nform me why that
does not work.


Back to the main subject...

So I will att= ach two files here, the first is an 'adapted' bookroll.el file, and= the second is a
a modified doc-view file that implements the fir= st 'rudimentary' continuous scroll for PDF
documents(desp= ite 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 capa= ble of diffing it with
the latest doc-view.el file yourself ;). <= br>
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 docu= ments I've tried to 'determine' split points using `forward-lin= e`, but that did not give satisfactory results.

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

So now some c= omments on the files/approach:

To understand the a= pproach 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 draw= s a triplet of images (pages)
for each page (and a doublet for th= e 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 heigh= t.

In the single page doc-view there is a single o= verlay, that informs via its properties many doc-view functions about which= step to take next (it controls the doc-view 'process'). In the boo= kroll
doc-view version, This overlay is kept as a 'control= 9; overlay, which is not used for containing images. The overlays for '= holding' the images are in the `overlay-list`. (Although this solution<= /div>
for the control overlay looks simple, it took me quite some inves= tigation 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 betw= een the pages

So, anyone who is interested can= have a look at the code, and of course any feedback and suggestions are we= lcome 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 pra= ctice', then I am very happy with good/better suggestions.

As I have to take care of 'fixing' the 'resizi= ng/scaling/zoom' functionality now, any comments
ideas on tha= t part would be welcome in particular...

Quite obv= iously, to test it, load the bookmark.el file, then load the doc-view.el fi= le, open some PDF document and start scrolling using `j`/`k`.
--00000000000052553f05d574b564--