unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Feature request for extra configuration variable.
@ 2022-05-03 11:30 dalanicolai
  2022-05-03 23:12 ` Yuan Fu
  2022-05-04  0:38 ` Po Lu
  0 siblings, 2 replies; 6+ messages in thread
From: dalanicolai @ 2022-05-03 11:30 UTC (permalink / raw)
  To: Emacs Devel

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

As I have already mentioned here before, I have written image-roll.e
<https://github.com/dalanicolai/image-roll.el>l which provides an
'improved' document 'display engine', to give a better reading scrolling
experience. The package already works quite fine for doc-view en pdf-tools.
However, there is a remaining issue, for which I have asked some question
already here
<https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg01289.html>.

Now I could add extra logic to fix that issue, but I prefer to keep the
code as straightforward, clear and simple as possible.

The issue is due to the behavior, that if some line is already on screen,
then, when jumping to that line will not make the line the 'window start'.
When jumping to a line that is off-screen the problem does not occur, i.e.
Emacs makes it the `window-start` automatically.

The package is implemented so that each page is (on overlay over) a single
line (i.e. a single space). The 'current page' should always be the page
at/overlapping with the window start. So when jumping to a next page, the
new page (i.e. line) should become the new window start.
All pages that are 'calculated' to be not 'on-window' (in view) will get
'undisplayed' to save memory.

So all pages above the 'new current page' get undisplayed, but when the
'new current page' is already within view (on-window), then when we jump to
the new page, the page does not become the window start, and the
undisplayed pages above it stay visible.

When I try to use `(set-window-start ...)`, then for some reason
subsequently setting `vscroll` does not work.
Setting vscroll does work after a `(redisplay)` but then the jump becomes
very 'ugly'.

Now, as obviously, there is already some (visually) 'clean' way to jump to
some line and make it the window start (namely what happens automatically,
when the new line is off-screen before the jump), I would expect that it
should be quite easy to 'apply' the 'same mechanism' when the 'new line' is
already on screen (which does NOT apply currently).

Now, of course it could be that there already exists some 'scrolling'
configuration variable that takes care of this, but I am unable to find it,
and no one responded to my earlier question.

So finally, my request is, if such variable does not exist, would it be
possible to add some variable so that Emacs uses the 'same mechanism' for
jumping to a line that is already 'on-window' as it uses for jumping to
lines that are 'off-window' before jumping?

Then I could keep the code of the package, nice, clear and simple.

Thank you!

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

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

* Re: Feature request for extra configuration variable.
  2022-05-03 11:30 Feature request for extra configuration variable dalanicolai
@ 2022-05-03 23:12 ` Yuan Fu
  2022-05-03 23:14   ` Yuan Fu
  2022-05-04  0:38 ` Po Lu
  1 sibling, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2022-05-03 23:12 UTC (permalink / raw)
  To: dalanicolai; +Cc: Emacs Devel



> On May 3, 2022, at 4:30 AM, dalanicolai <dalanicolai@gmail.com> wrote:
> 
> As I have already mentioned here before, I have written image-roll.el which provides an 'improved' document 'display engine', to give a better reading scrolling experience. The package already works quite fine for doc-view en pdf-tools. However, there is a remaining issue, for which I have asked some question already here.
> 
> Now I could add extra logic to fix that issue, but I prefer to keep the code as straightforward, clear and simple as possible.
> 
> The issue is due to the behavior, that if some line is already on screen, then, when jumping to that line will not make the line the 'window start'. When jumping to a line that is off-screen the problem does not occur, i.e. Emacs makes it the `window-start` automatically.
> 
> The package is implemented so that each page is (on overlay over) a single line (i.e. a single space). The 'current page' should always be the page at/overlapping with the window start. So when jumping to a next page, the new page (i.e. line) should become the new window start.
> All pages that are 'calculated' to be not 'on-window' (in view) will get 'undisplayed' to save memory.
> 
> So all pages above the 'new current page' get undisplayed, but when the 'new current page' is already within view (on-window), then when we jump to the new page, the page does not become the window start, and the undisplayed pages above it stay visible.
> 
> When I try to use `(set-window-start ...)`, then for some reason subsequently setting `vscroll` does not work.
> Setting vscroll does work after a `(redisplay)` but then the jump becomes very 'ugly’.


Pardon me if I understood you, but have you tried setting NOFORCE argument to t? Like so:

(set-window-start nil (point) t)
(set-window-vscroll nil scroll-amount t)

I have code like this running fine for one of my packages, maybe that can solve your problem.

Yuan







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

* Re: Feature request for extra configuration variable.
  2022-05-03 23:12 ` Yuan Fu
@ 2022-05-03 23:14   ` Yuan Fu
  0 siblings, 0 replies; 6+ messages in thread
From: Yuan Fu @ 2022-05-03 23:14 UTC (permalink / raw)
  To: dalanicolai; +Cc: Emacs Devel

> 
> Pardon me if I understood you, but have you tried setting NOFORCE argument to t? Like so:
> 
> (set-window-start nil (point) t)
> (set-window-vscroll nil scroll-amount t)
> 
> I have code like this running fine for one of my packages, maybe that can solve your problem.

I found these comments in my code:

    ;; The third argument `t' tells redisplay that (point) doesn't
    ;; have to be the window start and completely visible. That
    ;; allows our vscroll value to survive.

Yuan


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

* Re: Feature request for extra configuration variable.
  2022-05-03 11:30 Feature request for extra configuration variable dalanicolai
  2022-05-03 23:12 ` Yuan Fu
@ 2022-05-04  0:38 ` Po Lu
  2022-05-04  7:16   ` dalanicolai
  2022-05-04 22:53   ` Yuan Fu
  1 sibling, 2 replies; 6+ messages in thread
From: Po Lu @ 2022-05-04  0:38 UTC (permalink / raw)
  To: dalanicolai; +Cc: Emacs Devel

dalanicolai <dalanicolai@gmail.com> writes:

> When I try to use `(set-window-start ...)`, then for some reason subsequently setting `vscroll` does not work.
> Setting vscroll does work after a `(redisplay)` but then the jump becomes very 'ugly'.

That is because the window start will be forced after the next
redisplay.  The fix is to pass t as the `noforce' parameter to
`set-window-start'.

If you're interested in this, I suggest to look at some of the code in
pixel-scroll.el.



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

* Re: Feature request for extra configuration variable.
  2022-05-04  0:38 ` Po Lu
@ 2022-05-04  7:16   ` dalanicolai
  2022-05-04 22:53   ` Yuan Fu
  1 sibling, 0 replies; 6+ messages in thread
From: dalanicolai @ 2022-05-04  7:16 UTC (permalink / raw)
  To: Po Lu; +Cc: Emacs Devel

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

Great! Thanks, this was exactly what I was looking for.
So the basic functionality of image-roll is complete now.

I will have a look at pixel.scroll.el.
If you like, you could try image-roll here
<https://github.com/dalanicolai/image-roll.el>
(it can be used with doc-view and pdf-tools, see instructions).


On Wed, 4 May 2022 at 02:38, Po Lu <luangruo@yahoo.com> wrote:

> dalanicolai <dalanicolai@gmail.com> writes:
>
> > When I try to use `(set-window-start ...)`, then for some reason
> subsequently setting `vscroll` does not work.
> > Setting vscroll does work after a `(redisplay)` but then the jump
> becomes very 'ugly'.
>
> That is because the window start will be forced after the next
> redisplay.  The fix is to pass t as the `noforce' parameter to
> `set-window-start'.
>
> If you're interested in this, I suggest to look at some of the code in
> pixel-scroll.el.
>

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

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

* Re: Feature request for extra configuration variable.
  2022-05-04  0:38 ` Po Lu
  2022-05-04  7:16   ` dalanicolai
@ 2022-05-04 22:53   ` Yuan Fu
  1 sibling, 0 replies; 6+ messages in thread
From: Yuan Fu @ 2022-05-04 22:53 UTC (permalink / raw)
  To: Po Lu; +Cc: dalanicolai, Emacs Devel



> On May 3, 2022, at 5:38 PM, Po Lu <luangruo@yahoo.com> wrote:
> 
> dalanicolai <dalanicolai@gmail.com> writes:
> 
>> When I try to use `(set-window-start ...)`, then for some reason subsequently setting `vscroll` does not work.
>> Setting vscroll does work after a `(redisplay)` but then the jump becomes very 'ugly'.
> 
> That is because the window start will be forced after the next
> redisplay.  The fix is to pass t as the `noforce' parameter to
> `set-window-start'.
> 
> If you're interested in this, I suggest to look at some of the code in
> pixel-scroll.el.
> 

We probably should mention set-window-vscroll in the documentation of set-window-start. It is currently impossible to know set-window-vscroll wouldn’t work after set-window-start without knowledge of Emacs redisplay internals.

Yuan


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

end of thread, other threads:[~2022-05-04 22:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 11:30 Feature request for extra configuration variable dalanicolai
2022-05-03 23:12 ` Yuan Fu
2022-05-03 23:14   ` Yuan Fu
2022-05-04  0:38 ` Po Lu
2022-05-04  7:16   ` dalanicolai
2022-05-04 22:53   ` Yuan Fu

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