unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* papyrus.el, improved/simplified/"final" implementation of continuous scroll
@ 2022-04-16 16:37 dalanicolai
  2022-04-16 16:46 ` Eli Zaretskii
  2022-04-16 16:49 ` Redisplay issues with 'space' display properties on overlays Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: dalanicolai @ 2022-04-16 16:37 UTC (permalink / raw)
  To: Emacs Devel

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

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
<https://github.com/dalanicolai/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
<https://github.com/dalanicolai/pdf-tools/blob/papyrus-version/lisp/pdf-scroll.el>
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
<https://github.com/dalanicolai/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
<https://github.com/dalanicolai/pdf-tools/blob/papyrus-version/lisp/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.

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-04-16 21:39 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-16 16:37 papyrus.el, improved/simplified/"final" implementation of continuous scroll dalanicolai
2022-04-16 16:46 ` Eli Zaretskii
2022-04-16 19:00   ` dalanicolai
2022-04-16 16:49 ` Redisplay issues with 'space' display properties on overlays Eli Zaretskii
2022-04-16 18:17   ` dalanicolai
2022-04-16 18:32     ` Eli Zaretskii
2022-04-16 18:40       ` dalanicolai
2022-04-16 19:02         ` Eli Zaretskii
2022-04-16 18:47       ` dalanicolai
2022-04-16 18:57         ` dalanicolai
2022-04-16 19:06         ` Eli Zaretskii
2022-04-16 19:16           ` dalanicolai
2022-04-16 19:18             ` Eli Zaretskii
2022-04-16 19:33               ` dalanicolai
2022-04-16 19:52                 ` dalanicolai
2022-04-16 21:39                   ` dalanicolai
2022-04-16 19:36           ` dalanicolai
2022-04-16 18:32     ` dalanicolai
2022-04-16 18:36       ` Eli Zaretskii
2022-04-16 18:38         ` Eli Zaretskii
2022-04-16 18:49           ` dalanicolai

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).