unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: 22404@debbugs.gnu.org
Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.
Date: Tue, 19 Jan 2016 19:50:08 +0200	[thread overview]
Message-ID: <83mvs1bgrz.fsf@gnu.org> (raw)
In-Reply-To: <m260yqdsp7.wl%esq@lawlist.com> (message from Keith David Bershatsky on Mon, 18 Jan 2016 21:49:40 -0800)

> Date: Mon, 18 Jan 2016 21:49:40 -0800
> From: Keith David Bershatsky <esq@lawlist.com>
> 
> As a feature request, please consider adding an alternative method to force the `window-scroll-functions` hook to run -- but NOT more than it would normally run. [In other words, it shouldn't run 3 times.]  I only found `(set-window-buffer (selected-window) (current-buffer))` as a viable means to achieve this goal.  `run-window-scroll-functions` runs immediately and is not a viable substitute for this feature request.  Some users may not wish to `set-window-buffer` or run the `window-configuration-change-hook` to achieve this feature request.
> 
> In my particular use case, I want to run a custom function only one time per command loop that is dependent upon the new `window-start` and `window-end`, which is only reliably available to the user after the `post-command-hook` has run its course.  My function is too costly time-wise to run more than once each command loop.  I have tried, to no avail, to come up with a test to ascertain with 100% accuracy (from the `post-command-hook`) to guess whether the `window-scroll-functions` hook will run and/or whether it will run more than one time (e.g., when cursor/point is partially visible).  I played around with `(pos-visible-in-window-p nil nil t)` and whether it returned a length of 0, 2 or 6 -- however, from the `post-command-hook`, that is insufficient to ascertain with 100% accuracy w
 hether the `window-scroll-functions` hook will run once or twice or not at all.  The solution, I believe, is to force the `window-scroll-functions` hook to run during every redisplay -- but not more than it would normally run.
> 
> In other words, I want the `window-scroll-functions` hook to run every command loop when my custom minor-mode is active -- or twice if point/cursor is only partially visible (at the bottom of the window) and needs to be moved up a smidgen by redisplay.
> 
> Background:  my custom function is a cross-hairs created with overlays that works with `word-wrap` -- the vertical line is XPM that matches the character and color underneath.

Can you please tell more details about the problem you have?  I;ve
read this description several times, and couldn't figure out why are
you having problems.

For example, why can't you run your function from the
post-command-hook directly?  If you want it to run after all the hook
functions finished, you can use the APPEND argument to add-hook,
right?

Or if the above somehow doesn't work, what about pre-command-hook?

And those are just 2 random thoughts that went through my head while I
was reading your request.

Thanks.





  reply	other threads:[~2016-01-19 17:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  5:49 bug#22404: 25.1.50; Forcing `window-scroll-functions` to run Keith David Bershatsky
2016-01-19 17:50 ` Eli Zaretskii [this message]
2016-01-19 18:49 ` Keith David Bershatsky
2016-01-19 19:39   ` Eli Zaretskii
2016-01-19 18:53 ` John Wiegley
2016-01-19 19:26 ` Keith David Bershatsky
2016-01-19 20:35 ` Keith David Bershatsky
2016-01-20 13:34   ` Eli Zaretskii
2016-01-19 23:07 ` Keith David Bershatsky
2016-01-21  2:32 ` Keith David Bershatsky
2016-01-21 17:41   ` Eli Zaretskii
2016-01-21 19:54 ` Keith David Bershatsky
2016-01-21 20:28   ` Eli Zaretskii
2016-01-29 12:00     ` Michael Heerdegen
2016-01-29 14:37       ` Eli Zaretskii
2016-01-29 14:57         ` Michael Heerdegen
2016-01-29 15:33           ` Eli Zaretskii
2016-01-21 21:11 ` Keith David Bershatsky
2016-01-29  2:14   ` John Wiegley
2016-01-29  3:08 ` Keith David Bershatsky
2016-01-29  8:42   ` Eli Zaretskii
2016-01-29 15:54 ` Keith David Bershatsky
2016-02-01  3:50 ` Keith David Bershatsky
2016-02-01 19:54   ` Eli Zaretskii
2016-02-01 13:18 ` Keith David Bershatsky
2016-02-02 16:34   ` Eli Zaretskii
2016-02-02  5:58 ` Keith David Bershatsky
2016-02-02 18:16 ` Keith David Bershatsky
2016-02-02 18:43   ` Eli Zaretskii
2016-02-02 20:00 ` Keith David Bershatsky
2016-02-02 21:05 ` Keith David Bershatsky
2016-02-08  8:51 ` Keith David Bershatsky
2016-02-08 17:17   ` Eli Zaretskii
2016-02-09 16:00 ` Keith David Bershatsky
2016-02-09 17:48   ` Eli Zaretskii
2016-02-12  0:14 ` Keith David Bershatsky
2016-02-12  8:18   ` Eli Zaretskii
2016-02-16  3:39     ` Keith David Bershatsky
2016-02-22  6:05 ` Keith David Bershatsky
2016-03-11 16:21 ` 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

  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=83mvs1bgrz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=22404@debbugs.gnu.org \
    --cc=esq@lawlist.com \
    /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).