GNU bug report logs -
#17678
24.4.50; Feature Request -- calculate new `window-start` & `window-end` before visual redisplay
Previous Next
Full log
View this message in rfc822 format
I believe splitting up the work between the two hooks may be possible -- I will need to revise the conditions once I identify additional situations. As far as I can tell, the `window-scroll-functions` hook is NOT triggered when `point` STAYS between *old* `window-start` and *old* `window-end`. So when `point` STAYS between *old* `window-start` and *old* `window-end`, I will need to use the `post-command-hook`. When point moves BEYOND *old* `window-start` or `*old* `window-end`, then the `window-scroll-functions` hook can take over -- with a forced new `(window-end nil t)`.
`window-scroll-functions`:
(or
(< (point) (window-start)) ;; good for things like `beginning-of-buffer`
(> (point) (window-end)) ;; good for things like `end-of-buffer`
(> (point) (window-end nil t))) ;; good for things like `yank`
`post-comand-hook`
(and
(not (< (point) (window-start)))
(not (> (point) (window-end)))
(not (> (point) (window-end nil t))))
I haven't tried it yet, but it appears to make sense based on what I saw this morning with some `messages` that I set up using each hook.
Keith
---------------------------------------
On Jun 13, 2014, at 10:55 AM, Eli Zaretskii wrote:
>> Date: Fri, 13 Jun 2014 09:22:07 -0700
>> From: Keith David Bershatsky <esq <at> lawlist.com>
>> Cc: 17678 <at> debbugs.gnu.org
>>
>> The `window-scroll-functions` hook would be more useful if the value of `window-start` could be obtained *before* running the `post-command-hook`. At the present time, it would appear that the `post-command-hook` runs *before* the `window-scroll-functions` hook. Therefore, the `post-command-hook` cannot presently use the `window-start` value produced from the `window-scroll-functions` hook (which occurs *after* the `post-command-hook` has already finished).
>
> Yes, post-command-hook runs before window-scroll-functions. That's
> because post-command-hook runs immediately after a command execution
> is finished and Emacs is about to return to the command loop, while
> window-scroll-functions run as part of redisplay, which is entered
> whenever Emacs is idle, i.e., after the return to the command loop.
>
> Unfortunately, what you are asking for is not possible with the
> current design of Emacs, because window-start is computed as part of
> redisplay (it is one of the most important functions of redisplay to
> compute that).
>
> OTOH, I don't understand why do you need what you ask for. For
> example, why can't you do whatever you need from
> window-scroll-functions, instead of doing some of it in
> post-command-hook? Perhaps you should describe the problem you are
> trying to solve in more detail.
This bug report was last modified 11 years and 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.