all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>, 32637@debbugs.gnu.org
Subject: bug#32637: 27.0.50; window-size-change-functions not run from local hook
Date: Wed, 05 Sep 2018 09:47:24 +0200	[thread overview]
Message-ID: <5B8F8A0C.1030908@gmx.at> (raw)
In-Reply-To: <87musx9dr1.fsf@mail.linkov.net>

 > 0. In emacs -Q open two windows: one with the *scratch* buffer,
 > another window with the *Messages* buffer with e.g. ‘C-h e’
 > (view-echo-area-messages).
 >
 > 1. In *scratch* eval:
 >
 > (add-hook 'window-size-change-functions
 > 	  (lambda (frame) (message "%S" frame))
 > 	  nil t)
 >
 > 2. Resize windows with e.g. ‘C-x {’ (shrink-window-horizontally)
 >     Check the message with the frame name in *Messages*, fine.
 >
 > 3. Select the window with *Messages* with ‘C-x o’ (other-window),
 >     and resize again ‘C-x }’
 >
 > No message in *Messages*, because the hook was not called,
 > but actually the size of the *scratch* buffer was changed.
 >
 > window-size-change-functions needs to notify the buffer
 > that requested such notifications via this hook.

This is a legitimate request but I'm not sure whether we should do
that for two reasons:

The first reason is that we already run a buffer-local part of
'window-configuration-change-hook' and I dislike it.  Selecting a
window and making its buffer current for the sake of running a hook is
a bad idea IMO because both, selected window and current buffer, are
vital informations and a function run by a hook should be aware of
them.  Worse even, we already make the selected window's buffer
current first which might defeat the expectations of a function run by
the global hook.

Also the window in question might not have changed at all.  The thing
that did change is the window configuration of a frame and it would be
much more interesting if the hook told me what really has changed
instead of telling me that a buffer's window might have changed.

The second reason is a purely technical one: We'd have to walk the
window tree to find out which buffer may have been affected.  However,
the function run by the local hook would still have to find out which
window(s) shouwing the buffer was (were) potentially affected.  This
means that the buffer-local function would have to walk the window
tree a second time anyway.

But I admit that from the application programmer's POV the behavior
you ask for might be convenient, so patches are welcome.  See the code
of run_window_configuration_change_hook in window.c for how to do that
but please do _not_ introduce any side effects when running the global
'window-size-change-functions'.

martin






  reply	other threads:[~2018-09-05  7:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 21:03 bug#32637: 27.0.50; window-size-change-functions not run from local hook Juri Linkov
2018-09-05  7:47 ` martin rudalics [this message]
2018-09-05 15:26   ` Eli Zaretskii
2018-09-05 21:56     ` Juri Linkov
2018-09-06  2:35       ` Eli Zaretskii
2018-09-06 22:17         ` Juri Linkov
2018-09-05 21:54   ` Juri Linkov
2018-09-06  7:05     ` martin rudalics
2018-09-06 22:06       ` Juri Linkov
2018-09-07  7:31         ` martin rudalics
2018-09-08 23:56           ` Juri Linkov
2018-09-09  6:03             ` Eli Zaretskii
2018-09-09  8:40             ` martin rudalics
2018-09-09 15:59               ` Eli Zaretskii
2018-09-10  8:29                 ` martin rudalics
2018-09-09 16:17               ` Juri Linkov
2018-09-10  8:29                 ` martin rudalics

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=5B8F8A0C.1030908@gmx.at \
    --to=rudalics@gmx.at \
    --cc=32637@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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.