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: 22404@debbugs.gnu.org
Subject: bug#22404: 25.1.50; Forcing `window-scroll-functions` to run.
Date: Sun, 31 Jan 2016 19:50:05 -0800	[thread overview]
Message-ID: <m2powh2ioi.wl%esq@lawlist.com> (raw)
In-Reply-To: <m260yqdsp7.wl%esq@lawlist.com>

[-- Attachment #1: Type: text/plain, Size: 3119 bytes --]

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:

(setq scroll-conservatively 101)

(setq wsf-var t)

(defun hr-pch-fn ()
  (force-wsf (selected-window)))

(defun hr-wsf-fn (win start end pbol-start peol-end)
  (message "win: %s | start: %s | end: %s | peol-start: %s | peol-end: %s"
    win start end pbol-start peol-end))

(add-hook 'post-command-hook 'hr-pch-fn t t)

(add-hook 'wsf-hook 'hr-wsf-fn nil t)


[-- Attachment #2: wsf.diff --]
[-- Type: application/diff, Size: 12566 bytes --]

  parent reply	other threads:[~2016-02-01  3:50 UTC|newest]

Thread overview: 41+ 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 [this message]
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-12  8:25   ` Why do idle timers trigger redisplay? Eli Zaretskii
2016-02-22  6:05 ` bug#22404: 25.1.50; Forcing `window-scroll-functions` to run 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

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

  git send-email \
    --in-reply-to=m2powh2ioi.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=22404@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.