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: papyrus.el, improved/simplified/"final" implementation of continuous scroll Date: Sat, 16 Apr 2022 18:37:24 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fad04e05dcc824bc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15802"; 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 Sat Apr 16 18:38:53 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 1nflRl-0003x6-2M for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Apr 2022 18:38:53 +0200 Original-Received: from localhost ([::1]:50008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nflRj-0001CJ-PD for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Apr 2022 12:38:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nflQZ-0000VT-E2 for emacs-devel@gnu.org; Sat, 16 Apr 2022 12:37:39 -0400 Original-Received: from mail-yb1-xb29.google.com ([2607:f8b0:4864:20::b29]:33471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nflQX-0004n1-6X for emacs-devel@gnu.org; Sat, 16 Apr 2022 12:37:39 -0400 Original-Received: by mail-yb1-xb29.google.com with SMTP id j2so19208758ybu.0 for ; Sat, 16 Apr 2022 09:37:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=bv6Zh2tMF+hkdU7yNC+rBS+uyN0uOXU+Czsp4IdCmaE=; b=PX9Q1yACgQR1PJYChRQKIELZf+N27f1pY6fna5sptmmJeBIPRBpkuuYjeiYvQvfIoo jJIic9Rug4SBvRe7WFezbX8TRuQjATB+vwBrvZwTG6ZImBDGDjpViyCFGcdg1BQWKYCS ypNUUf7hoayb7cIeFDBe6fLLRbD9MoD+w8L3BRE/f4oZAKpORQdqiwhSk13RO2FgTHFb 4DzDntNZeOkh7EgYBOTOQVHdLdqXMp2ObPQWRTAZdXw1ADRXBsDGpgCNlWFxKeZomyp1 xqsrEQdDGbWY12NI4jiQZIjwsRcqm2Qk9S7eHnIlGFoFk7GppwFEZnpT831D/+V3u0w3 JvFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=bv6Zh2tMF+hkdU7yNC+rBS+uyN0uOXU+Czsp4IdCmaE=; b=EfJhYxAg7wr/ZQGmUmiymjdzlzpfPvx3kberk6w0ISw8547OdtmyFZwhv5ImYJokhl eIisIGcHNm2n1cj84pY4HT4pshFVaEWDReJitL/GadAS3J8lN6fhHWVr0dUcmKfSit+6 WUYKVE96y3fvcYcUrh1KR8af6U1Am7wbPofulqk/ghf3BO+lTuVCAcK/wEDOMpI9rOa5 6gE/HKKf2GRpcmkOXGaRh9WmpNP414THjzlQPuIPykDjK9lvHLIUbS1MVwjE51xHHuRO EuUkfP2ayHkulszRj4WCbYRcMKejjOwu3z08jymhPNbeZxnGHckVTVIkZZCL5grXUpKZ v48Q== X-Gm-Message-State: AOAM532/cwxBsAYasB05Eg9MmmPrzzgg0Vay7DZPy0CY+rg51+mfaNpa 59DovHF1tVh/aSmQhnOfV6XAng8rWiQwgr1NG9Mk1KTgym5kIQ== X-Google-Smtp-Source: ABdhPJxCd4lZpGHYN5fQmQuWg3etVUyg4jHWKiiY71ruaLFCLMfO15Ao5PjTIdYl7rXoPrjS9G0IQCfjn0LnCJvPsgc= X-Received: by 2002:a05:6902:392:b0:633:621f:166f with SMTP id f18-20020a056902039200b00633621f166fmr3798537ybs.166.1650127055537; Sat, 16 Apr 2022 09:37:35 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::b29; envelope-from=dalanicolai@gmail.com; helo=mail-yb1-xb29.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:288484 Archived-At: --000000000000fad04e05dcc824bc Content-Type: text/plain; charset="UTF-8" This mail contains two question, one about Emacs redisplay behavior, and another one about minimum heights of specified spaces. However, another purpose of this mail is to 'announce' the 'library' papyrus.el . I have extracted the (continuous) scroll feature into a separate file. In the process I have greatly simplified and improved earlier implementations. So this file implements a 'scroll/bookroll' for displaying documents. For now, I have named it 'papyrus.el' because 'scroll' and 'book(roll)' where 'clashing' too much with already existing function names/namespaces. The final file is only 358 lines long (including spaces and comments, and the code is fairly straightforward and I guess very easy to understand for most/all of you. The papyrus.el code only implements a scroll and some logic for scrolling and (un)displaying pages/images. I have created a separate pdf-scroll.el in the papyrus-version branch of my pdf-tools fork to make pdf-tools use papyrus.el. I am not intending (at least for now) to also create 'doc-view extensions' to make it use papyrus.el as that is a little more involved than creating the support for pdf-tools. This is mostly because for creating the scroll, the page-sizes have to be retrieved before displaying the document, which is easy to do in pdf-tools but requires some extra work in doc-view. Now here follow my two questions: 1. papyrus.el uses the `papyrus-redisplay` function, which creates the 'scroll' by adding 'space' display properties to the overlays, and page images to the 'currently visible overlays'. The redisplay works fine on Spacemacs/Doom, but for vanilla Emacs, in order to 'finalize' the process requires a hack which is to 'print' something to the echo area, after which the 'redisplay' will finish and show the images. I have tried to use `redisplay/force-window-update` for this, but those do not seem to have the right effect. Obviously, my question is if you can tell me why the hack 'is required' and what would be the better way to achieve/finalize the redisplay. 2. I would expect that a specified space (space display property for the 'gap' overlays, i.e. the space between the pages) could be smaller than the default 'line-pixel-height`. However, this does not seem possible by just setting a smaller :height for the space display property, as the overlay will always have a minimum height of the default 'line-pixel-height' To see/reproduce what I mean you can simply load `papyrus.el ` and do `M-x papyrus-demo`. You can experiment with the 'gap/space-height' by setting the `papyrus-gap-height`. For 'reproducing' the 'issue' of the first question, you can simply load pdf-scroll.el (but first set the correct path to `papyrus.el` at the beginning of that file. Also, pdf-scroll.el requires pdf-tools to be correctly installed). Subsequently, open some pdf file, and split the window. I hope you will find that the continuous scroll, including the functionality of the `pdf-tools-enabled-modes`, works perfectly fine in vanilla Emacs (scroll with arrows and page-down/up). Now, to see what I mean with the display 'issue' comment out the last two lines of the `papyrus-redisplay` function, and again try to split the window from the pdf buffer, you will find that the extra step of printing is required before the image will show correctly. Thanks for your help. B.t.w. also comments/ideas about how to add this to Emacs (elpa/core/pdf-tools?) are very welcome. --000000000000fad04e05dcc824bc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This mail contains two question, one about Emacs redisplay= behavior, and another
one about minimum heights of specified spaces. Ho= wever, another purpose of this
mail is to 'announce' the 'li= brary' papyrus.el= .

I have extracted the (continuous) scroll feature into a separa= te file. In the
process I have greatly simplified and improved earlier i= mplementations.

So this file implements a 'scroll/bookroll' = for displaying documents. For now, I
have named it 'papyrus.el' = because 'scroll' and 'book(roll)' where 'clashing'<= br>too much with already existing function names/namespaces.

Th= e final file is only 358 lines long (including spaces and comments, and the= code
is fairly straightforward and I guess very easy to understa= nd for most/all of you.

The papyrus.el code only implements a = scroll and some logic for scrolling and
(un)displaying pages/images= . I have created a separate
=C2=A0pdf-scroll.el= in the papyrus-version branch of my pdf-tools fork to make pdf-tools
=C2=A0use papyrus.el.

I am not intending (at least fo= r now) to also create 'doc-view extensions' to
make it use papyr= us.el as that is a little more involved than creating the
support for pd= f-tools. This is mostly because for creating the scroll, the
page-sizes = have to be retrieved before displaying the document, which is easy to
do= in pdf-tools but requires some extra work in doc-view.

Now here fol= low my two questions:

1. papyrus.el uses the `papyrus-redisplay` fun= ction, which creates the 'scroll'
by adding 'space' disp= lay properties to the overlays, and page images to
the 'currently vi= sible overlays'. The redisplay works fine on Spacemacs/Doom,
but for= vanilla Emacs, in order to 'finalize' the process requires a hack = which is
to 'print' something to the echo area, after which the = 'redisplay' will finish
and show the images.

I have tried= to use `redisplay/force-window-update` for this, but those do not
seem = to have the right effect.

Obviously, my question is if you can tell = me why the hack 'is required' and what
would be the better way t= o achieve/finalize the redisplay.


2. I would expect that a speci= fied space (space display property for the 'gap'
overlays, i.e. = the space between the pages) could be smaller than the default
'line= -pixel-height`. However, this does not seem possible by just setting a
s= maller :height for the space display property, as the overlay will always h= ave
a minimum height of the default 'line-pixel-height'

<= br>
To see/reproduce what I mean you can simply load `papyrus.el` and do
`M-x = papyrus-demo`. You can experiment with the 'gap/space-height' by se= tting
the `papyrus-gap-height`.


For 'reprodu= cing' the 'issue' of the first question, you can simply loadpdf-scroll.el (but first set the correct path to `pa= pyrus.el` at the beginning
of that file. Also, pdf-scroll.el requires pd= f-tools to be correctly installed).
Subsequently, open some pdf file, an= d split the window. I hope you will find
that the continuous scroll, inc= luding the functionality of the
`pdf-tools-enabled-modes`, works pe= rfectly fine in vanilla Emacs (scroll with arrows
and page-down/u= p). Now, to see what I mean with the display 'issue' comment out th= e
last two lines of the `papyrus-redisplay` function, and again tr= y to split the
window from the pdf buffer, you will find that the extra = step of printing is
required before the image will show correctly.
Thanks for your help. B.t.w. also comments/ideas about how to add this to=
Emacs (elpa/core/pdf-tools?) are very welcome.
--000000000000fad04e05dcc824bc--