bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32637: 27.0.50; window-size-change-functions not run from local hook


From: Juri Linkov
Subject: bug#32637: 27.0.50; window-size-change-functions not run from local hook
Date: Sun, 09 Sep 2018 02:56:35 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> But in bug#32536 you agreed that Man-window-size-change has to
>> take care of cases where buffer-local window-size-change-functions
>> needs to find all Man windows on the frame to compare their sizes
>> and reformat the buffer with the minimim width from all its windows.
>>
>> So the window-size-change-functions hook should call the function not
>> with the window as argument, but with the whole frame, as it already
>> does now.  And to call the buffer-local hook only once for all
>> affected windows, as it already does now (the hook has responsibility
>> to find all its windows from the frame).
>
> I meant that running 'window-size-change-functions' in a buffer-local
> fashion when no window showing that buffer has changed its size might
> be misleading.

window-size-change-functions calling code could detect if a window with
a buffer-local hook changed its size, and not to call its hook in this
case.  This would be even better than using global hook where you can't
implement such optimization.

> But put a buffer-local function on 'window-configuration-change-hook'
> and show the buffer in two windows.  The function gets called twice
> with the respective window selected.  So if we implemented
> 'window-size-change-functions' in the same way as you suggested
> earlier, you would "find all Man windows on the frame to compare their
> sizes and reformat the buffer with the minimim width from all its
> windows" twice.  How would you deal with that?

window-size-change-functions calling code could call it only once
for every frame, even if the same buffer is displayed in multiple
windows.

>>> And I still think that running 'window-configuration-change-hook'
>>> buffer-locally in its current from hardly makes sense either: For
>>> example, we don't call it for a buffer when that buffer has been
>>> removed from a window which incidentally is the case that would allow
>>> Man to remove its function from 'window-configuration-change-hook'.
>>
>> There is no need to remove function from the buffer-local hook,
>> because it is called only when the buffer is displayed
>> in a window.
>
> As you noted earlier, a buffer-local 'window-size-change-functions'
> function gets called regardless of whether the buffer is shown in a
> window on the frame in question.

I see that it's not called when the buffer is not displayed in any
window on the frame - this is correct.  But what I noted earlier is that
it's not called when the buffer with the buffer-local hook is not the
current-buffer in the selected window (but it's displayed in a
non-selected window on the frame) - this should be fixed to call the hook
regardless if its window is currently selected or not.

> And if we wanted to fix that, we probably need something better than
> imitating 'window-configuration-change-hook'.

I think window-configuration-change-hook is a step forward in the
right direction.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]