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

[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: Lars Ingebrigtsen
Subject: bug#9867: 24.0.90; quit-window should provide quit-window-hook
Date: Fri, 30 Aug 2019 11:40:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> Not normally.  It's wrapped in an unwind protection form like
> 'with-current-buffer'.  The following untested snippet should be (1)
> fairly optimal for the normal case where the selected window is quit
> and (2) guard against the case where the function run on the hook does
> soemthing unexpected with the window configuration:
>
> (let ((window (window-normalize-window window))
>       (buffer (window-buffer window)))
>   (if (and (eq window (selected-window))
>          (eq buffer (current-buffer)))
>       (run-hooks 'quit-window-hook)
>     ;; Select WINDOW for `quit-window-hook'.
>     (with-selected-window window
>       (run-hooks 'quit-window-hook)))
>   ;; Run 'quit-restore-window' only if 'quit-window-hook' has left
>   ;; WINDOW alone.
>   (when (and (window-live-p window)
>            (eq (window-buffer window) buffer))
>     (quit-restore-window window (if kill 'kill 'bury))))

I think the semantics of the command becomes rather muddled with this
change.  We currently provide no guarantees for what or how the hook
function should do, or whether it basically disables the command if it
changes the window and so on (which is what this change will do).

If you think this should be what the semantics are, then I won't argue,
so please feel free to go ahead and make whatever changes you want here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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