[Top][All Lists]

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

bug#9867: 24.0.90; quit-window should provide quit-window-hook

From: martin rudalics
Subject: bug#9867: 24.0.90; quit-window should provide quit-window-hook
Date: Tue, 20 Aug 2019 10:19:29 +0200

> It seems like Chong OK'd this hook at the time, but it was never added
> to Emacs.  I've now added it to Emacs 27, because it seems like a useful
> addition to have -- now modes that need to do some clean-up thing before
> doing whatever `quit-window' does can just add that to the hook
> (buffer-locally).

'quit-restore-window' can quit _any_ window not just the selected one.
This means that if a user puts something on a normal hook run by that
function, that something can only guess at which window is really quit
by that function.  Also, running a buffer-local value of that hook is
meaningless given the current implementation.  See the tribulations
run_window_configuration_change_hook runs into when trying to overcome
a similar problem (and note the unwind-protection overhead it incurs).

If people really need such a hook at all, please

- Make it either an abnormal hook run with the window quit as argument
  or run it from 'quit-window' but then only if it quits the selected

- Make sure to call any buffer-local value of that hook for the buffer
  of the window that is quit.

- Prefix it with 'quit-restore-' if you intend to run it from
  'quit-restore-window' (that function may be called by other
  functions as well).

- Fix the reference to the non-existent function 'quit-buffer'.

Thanks, martin

reply via email to

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