unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: dalanicolai <dalanicolai@gmail.com>
Cc: Tomas Hlavaty <tom@logand.com>, Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Multi image PDF continuous mode
Date: Mon, 10 Jan 2022 10:13:10 +0200	[thread overview]
Message-ID: <86a6g5xa21.fsf@mail.linkov.net> (raw)
In-Reply-To: <CACJP=3k3djkxgdiCtGy0YPOrcBJLfsrtS0EMHyO7TuY_DdTP6w@mail.gmail.com> (dalanicolai@gmail.com's message of "Sat, 8 Jan 2022 22:32:51 +0100")

> Okay, so I have got a working Proof of Concept / core functionality.
> You can very easily test it by loading the bookroll.el file from here,
> then do `M-x br-test` and scroll using `j`/`k`. I will now focus on trying
> to implement
> it into pdf-tools, which is probably a little more work as its code is
> quite complex/opaque.

One problem is that the vertical scroll bar doesn't allow scrolling all images.

>> Maybe then after a real image
>> will be scrolled out of view, it could be replaced with a placeholder again
>> to free memory.
>
> Haha, that is exactly what I meant with exactly that (the following)
> sentence.

This is nice that you already took care about this case.

>     > I would like to share my perspective on this, but before I do that,
>     > let me first ask you if you have any idea about why pdf-tools is not
>     part of
>     > Emacs. It is a very high quality package, that already lazily loads
>     the images,
>     > and provides many sophisticated features.
>
>     It would be nice to include pdf-tools in Emacs, but I don't know
>     if the new maintainer has an intention to submit it for inclusion.
>
>     > You might already be familiar with my 2-buffer continuous scroll hack
>     for it
>     > (which can be easily ported to doc-view mode, but 'developing' a
>     'real'
>     > continuous scroll mode solution makes much more sense
>
>     I agree, a real continuous scroll mode would be more preferable.
>
>     > - I have created a, very rude but already nicely working, 'real'
>     continuous
>     >   scroll proof of concept, for which, if you are interested, you can
>     find the
>     >   code in this commit. It currently uses a trick where it only uses
>     two images
>     >   at the time
>
>     While two-images approach could provide better optimization for memory,
>     it has severe limitations, e.g. the vertical scroll bar can't be used
>     to scroll all images at once.
>
>     >   but as I will describe now, I think it will be better to create a
>     >   'bookroll' package for it.
>
>     This is a promising direction.
>
>     > I think the bookroll should not be so difficult to implement (I first
>     started to
>     > think about a general 'image-roll', but I think continuous scrolling
>     is
>     > generally not what you want for viewing/scrolling images
>
>     Why not?  'image-roll' could be useful for the image gallery packages
>     like image-dired.el and thumbs.el.
>
>     > So my current idea for how to implement it, is by
>     > immediately creating overlays for all pages in a single buffer and
>     fill them
>     > with 'empty' svg-images of the correct size (after testing this with
>     a thousand
>     > 'placeholders', it seems that the 'empty' images use almost no
>     memory).
>
>     Good news, so loading a 1000-page document won't take much memory.
>     Only scrolling will load real images.  Maybe then after a real image
>     will be scrolled out of view, it could be replaced with a placeholder
>     again
>     to free memory.
>
>     > Then, the scrolling can be implemented, by changing the display
>     properties (from empty
>     > svg to real image, and back) and jumping to the correct positions
>     using
>     > `set-window-vscroll`. I have started on writing bookroll.el, of
>     course your
>     > joined efforts or feedback would be very much appreciated. Otherwise,
>     this short
>     > message serves just to inform you about these activities.
>
>     Thanks, feel free to post updates about your progress
>     or when stuck on some problems.



      reply	other threads:[~2022-01-10  8:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 17:05 Multi image PDF continuous mode Juri Linkov
2021-12-09 19:24 ` Stefan Kangas
2021-12-09 19:35 ` Tomas Hlavaty
2021-12-09 20:05   ` Juri Linkov
2022-01-08  7:11     ` dalanicolai
2022-01-08  7:18       ` dalanicolai
2022-01-08  7:24         ` dalanicolai
2022-01-08  9:34       ` Stefan Kangas
2022-01-08 18:17       ` Juri Linkov
2022-01-08 21:32         ` dalanicolai
2022-01-10  8:13           ` Juri Linkov [this message]

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=86a6g5xa21.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=dalanicolai@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=tom@logand.com \
    /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).