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

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

bug#19576: write-file writes the wrong buffer


From: martin rudalics
Subject: bug#19576: write-file writes the wrong buffer
Date: Fri, 20 Nov 2015 09:22:15 +0100

>> 100% agreed.  But run_window_configuration_change_hook goes a long way
>> saving and restoring current buffer and selected window around each call
>> to a function on ‘window-configuration-change-hook’.
>
> That function isn't called by the display engine, but only by a
> handful of functions that react to changes in windows.  So I really
> don't consider that to be an analogous case, sorry.

Reconsider.  ‘window-size-change-functions’ are processed by the display
engine because it's the one we expect to know that window resizing
activity has ceased.  And if you look at how packages use these two
hooks (and also ‘post-command-hook’) you will see that people should get
more help.  Just to quote from ‘linum-mode’

        ;; Using both window-size-change-functions and
        ;; window-configuration-change-hook seems redundant. --Stef

and

        (add-hook 'window-configuration-change-hook
                  ;; FIXME: If the buffer is shown in N windows, this
                  ;; will be called N times rather than once.  We should use
                  ;; something like linum-update-window instead.
                  'linum-update-current nil t)

>> People who put their functions on ‘window-size-change-functions’ and
>> ‘window-configuration-change-hook’ usually don't care about the precise
>> reason why these function get called.  They simply want to cover all
>> cases where a new window appears or a specific window changes size.  Do
>> we really expect them to add a ‘save-window-excursion’ in one case and
>> avoid it in the other because it would mean unnecessary extra work?
>
> Yes, we do.  Hooks called by the display engine should be coded very
> carefully, because they are a large part of that proverbial rope that
> Emacs gives us to hang ourselves.  If they don't write those hooks
> with great care, they get what they deserve.

People do care.  But how would they know that in one case we save all
sorts of things while we don't in the other.

At least the OP got what he deserved: Waiting one year for being told
that the bug he reported is his own fault.

martin






reply via email to

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