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: Mon, 01 Feb 2016 21:54:42 +0200	[thread overview]
Message-ID: <83vb68yznh.fsf@gnu.org> (raw)
In-Reply-To: <m2powh2ioi.wl%esq@lawlist.com> (message from Keith David Bershatsky on Sun, 31 Jan 2016 19:50:05 -0800)

> Date:  Sun, 31 Jan 2016 19:50:05 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  22404@debbugs.gnu.org,Michael Heerdegen <eliz@gnu.org>
> 
> I see that there are a few express circumstances in the function `window-end` where a forced update will not occur, even though a user expressly requested it with the optional argument being set to `t`.  Michael had mentioned an unspecified situation where `window-end` was incorrect from the `window-scroll-functions` hook even with a forced update, so perhaps one or more of those expressly coded exceptions is/are to blame.  I encountered a similar situation today in my testing with interactively calling `previous-line` at the top window edge (and scroll-conservatively 101) where the `window-end` was not updating correctly.
> 
> Attached is a diff-patch of the second draft for the new proposed animal that is somewhat similar to the `window-scroll-functions` hook, but this new animal is able to run every command loop even when there is no scrolling.  It automatically updates `window-end`, and it throws four (4) values that can be used by the user's custom function attached to the new hook:
> 
> * window-start
> * window-end
> * point at the beginning of the line of window-start.
> * point at the end of the line of window-end.
> 
> I added two new symbols for the mode-line:  little `%w` for `window-start` and big `%W` for `window-end`.  This made debugging much easier, and I do a lot with window-start/end, so it comes in handy for writing other related functions.
> 
> I removed one double quote in comments in `window.c` that was breaking my font-lock highlighting -- an unmatched double quotes in a comment always causes havoc with my highlighting for the remainder of the buffer, so I try to fix those whenever I come across them.
> 
> I still haven't figured out how to entirely substitute throwing the switch `w->wsf_toggle = true` with just a buffer-local variable.  Ideally, I would prefer that the new hook run whenever local variable `wsf-var` is `t` -- without needing a switch.  At the present time, I am throwing the switch each command loop with the `post-command-hook`.  [The switch gets set back to `false` during redisplay, and is needed as sort of a counter so that a section of the redisplay code does not run more than necessary.]
> 
> This draft diff-patch can of course still use some polishing up -- e.g., the forced window update only needs to occur when `wsf-var` is `t`.  In future drafts, I'll probably change some of the names to further distinguish this from the built-in WSF.  [The built-in WSF section near a patched comment labeled "2 of 3" should probably now have an exception so that it doesn't run merely because this new animal is running, and I'll think some more about that in the coming days.]  I'll be using this patch in my daily routine to see how it works out.  Here is the sample usage, which is designed to be buffer-local:

Keith, I appreciate all the efforts you are putting into this, but I'd
rather we'd not go in that direction.  Running Lisp from within the
bowels of redisplay is inherently dangerous (because Lisp code can
signal an error, which then makes Emacs not responsive due to infinite
attempts to display the error message, which causes another error,
etc.).  Your patches add more places where we call Lisp, and in
particular in places, like redisplay_window, where it simply is out of
the question.

I'd prefer to have a post-redisplay-hook, which is called either at
the end of redisplay cycle, or after redisplay_internal returns to its
caller.  Would that solve your problem, and if so, what information do
you need to be passed to such a hook?

Thanks.





  reply	other threads:[~2016-02-01 19:54 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
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 [this message]
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=83vb68yznh.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).