help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

save-restriction doesn't restore scroll


From: Psionic K
Subject: save-restriction doesn't restore scroll
Date: Sun, 24 Mar 2024 20:20:06 +0900

I came across a case where `save-restriction' can leave the window scrolled
to a new location.

To reproduce the behavior, try `org-babel-execute-subtree'.  The ending
scroll state will leave the subtree at the window start.

I believe this is due to babel writing results but didn't dig deeper for
this simple reasoning:

`save-restriction' is very, very likely to result in some kind of scrolling
either before or after the narrowing, so this macro's behavior should just
assume that it always needs to restore the scroll state in addition to the
narrowing state.  I can't think of a use case where the window's scroll
state would be intentionally modified in the body of `save-restriction`.
Whatever scrolling occurs during the temporary restriction state is likely
to be invalid and not what the user intended via their auto-scrolling
configuration.

The workaround for interactive cases is easy enough, using
`set-window-start', but this is likely incorrect for cases where the buffer
is not currently displayed?

Unless I'm missing something, consider this a bug report.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]