unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Michael Heerdegen" <eliz@gnu.org>,
	"Clément Pit--Claudel" <clement.pit@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Use cases for post-redisplay hooks
Date: Tue, 05 Jul 2016 10:45:02 -0700	[thread overview]
Message-ID: <m2twg4m129.wl%esq@lawlist.com> (raw)

I can explain it in layman's terms, but I'm not familiar enough with how redisplay works to describe in computer language what happens exactly.  [I'm a hobbyist / tinkerer, but do not have any formal training in programming.]

I saw that the `window-scroll-functions` hook (hereinafter "WSF") returned correct values for `window-start` and `window-end` in some circumstances, but not all.  I saw that the WSF had about two (2) occasions where it is forced to run with a built-in flag, so I borrowed that functionality.  The `window-start-end-hook' (hereinafter "WSEH") is kind of like the WSF on steroids.  Wherever the WSF would normally be called, the WSEH is also called.  I added one (2) additional location for the WSEH to deal with mouse wheel scrolling.  I throw the switch on the WSEH every command loop.  The WSEH has a check to see if point is fully visible, because that is when `window-start` and `window-end` will not likely change again (so long as the Lisp function attached to the WSEH doesn't alter those value
 s in any way).  When point is fully visible, then the function attached to the WSEH runs and my overlays are placed on the visible window.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Tue, 05 Jul 2016 04:12:30 -0400,
Stefan Monnier wrote:
> 
> > The implementation of the `window-start-end-hook` is probably easier to
> > explain with a diff, which is attached.
> 
> Hmm... my understanding of the redisplay code is sufficiently fuzzy that
> your patch doesn't actually tell me how it's supposed to work.
> More specifically the timing is unclear to me: the overlays you add from
> your hook affect the display, so you need to run (the bulk of) the
> redisplay code *after* running your hook.
> 
> So sounds more like a pre-redisplay-hook.  Except that you pre-compute
> the expected window-end somehow.
> 
> 
>         Stefan



             reply	other threads:[~2016-07-05 17:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 17:45 Keith David Bershatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-07-07 20:19 Use cases for post-redisplay hooks Keith David Bershatsky
2016-07-07 17:53 Keith David Bershatsky
2016-07-07 19:44 ` Clément Pit--Claudel
2016-07-04 22:50 Keith David Bershatsky
2016-07-05  8:12 ` Stefan Monnier
2016-07-07 16:08 ` Clément Pit--Claudel
2016-07-04 21:42 Keith David Bershatsky
2016-07-04 22:06 ` Stefan Monnier
2016-07-05  2:35 ` Eli Zaretskii
2016-07-04 16:39 Clément Pit--Claudel
2016-07-04 17:02 ` Eli Zaretskii
2016-07-04 17:15   ` Clément Pit--Claudel
2016-07-04 21:45 ` Stefan Monnier
2016-07-10 22:17 ` Clément Pit--Claudel
2016-07-11  3:34   ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2twg4m129.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=clement.pit@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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).