[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: find-file-hook, recenter, scroll-conservatively and save-place
From: |
Eli Zaretskii |
Subject: |
Re: find-file-hook, recenter, scroll-conservatively and save-place |
Date: |
Thu, 31 Jan 2019 16:43:27 +0200 |
> From: Gergely Risko <address@hidden>
> Date: Thu, 31 Jan 2019 14:46:40 +0100
>
> The hook that I need (something like find-file-with-window-hook) can
> be described like this: similar to find-file-hook, but called after a
> window has been chosen or created as necessary and the window's buffer
> has been changed to the buffer being opened. This hook would
> guarantee in its documentation that:
>
> current-buffer === (window-buffer (current-window))
>
> This new hook can be run-hook'd at the end of the various find-file-*
> user facing commands.
Before you go further down this rabbit hole, I suggest to try setting
scroll-conservatively to a smaller value, like 30. If that does what
you want, and doesn't cause recentering in too many other use cases,
you are done without any changes in Emacs.
Once upon a time scroll-conservatively only affected scroll commands,
such as scroll-up etc. But then users came up and demanded that this
setting should affect any motion command, including goto-char etc.
What you see is the consequence of that: Emacs does this by popular
demand. Any command that moves point outside of the window will,
under scroll-conservatively > 100, behave like you see, i.e. always
put point on the last or the first window line.
You could perhaps do what you want by some clever one-time setting in
pre-redisplay-functions. But it might not be easy, I'm afraid,
because you'd need to do that in a way that works only the first time
a buffer is displayed whose place was saved by save-place.
- find-file-hook, recenter, scroll-conservatively and save-place, Gergely Risko, 2019/01/31
- Re: find-file-hook, recenter, scroll-conservatively and save-place, Gergely Risko, 2019/01/31
- Re: find-file-hook, recenter, scroll-conservatively and save-place,
Eli Zaretskii <=
- Re: find-file-hook, recenter, scroll-conservatively and save-place, martin rudalics, 2019/01/31
- Re: find-file-hook, recenter, scroll-conservatively and save-place, Juri Linkov, 2019/01/31