all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 17678@debbugs.gnu.org
Subject: bug#17678: 24.4.50; Feature Request -- calculate new `window-start` & `window-end` before visual redisplay
Date: Fri, 13 Jun 2014 11:24:01 -0700	[thread overview]
Message-ID: <C6BE1FD6-6F20-4FB2-A650-82E5AC560C72@lawlist.com> (raw)
In-Reply-To: <83d2ecwv6g.fsf@gnu.org>

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@lawlist.com>
>> Cc:  17678@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.






  reply	other threads:[~2014-06-13 18:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 17:48 bug#17678: 24.4.50; Feature Request -- calculate new `window-start` & `window-end` before visual redisplay Keith David Bershatsky
2014-06-11 18:00 ` Stefan Monnier
2014-06-11 18:45   ` Eli Zaretskii
2014-06-11 21:58     ` Stefan Monnier
2014-06-12 17:54       ` Eli Zaretskii
2014-06-13  2:11         ` Stefan Monnier
2014-06-13  6:22           ` Eli Zaretskii
2014-06-13 12:34             ` Stefan Monnier
2014-06-13 13:27               ` Eli Zaretskii
2014-06-13 14:14                 ` Stefan Monnier
2014-06-13 14:47                   ` Eli Zaretskii
2014-06-13 18:47                     ` Stefan Monnier
2014-06-13 20:21                       ` Keith David Bershatsky
2014-06-13 20:59                       ` Eli Zaretskii
2014-06-14  9:45                         ` Eli Zaretskii
2014-06-14 17:10                           ` Keith David Bershatsky
2014-06-15  2:24                         ` Stefan Monnier
2014-06-13 16:22 ` Keith David Bershatsky
2014-06-13 17:55   ` Eli Zaretskii
2014-06-13 18:24     ` Keith David Bershatsky [this message]
2014-06-13 20:54       ` Eli Zaretskii
2014-06-13 21:19         ` Keith David Bershatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C6BE1FD6-6F20-4FB2-A650-82E5AC560C72@lawlist.com \
    --to=esq@lawlist.com \
    --cc=17678@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.