all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: martin rudalics <rudalics@gmx.at>
Cc: Christoph Scholtes <cschol2112@googlemail.com>, 9867@debbugs.gnu.org
Subject: bug#9867: 24.0.90; quit-window should provide quit-window-hook
Date: Fri, 30 Aug 2019 11:40:46 +0200	[thread overview]
Message-ID: <87sgpjhty9.fsf@gnus.org> (raw)
In-Reply-To: <79f9288e-c518-3607-78a7-2e0e0939851d@gmx.at> (martin rudalics's message of "Sun, 25 Aug 2019 10:11:16 +0200")

martin rudalics <rudalics@gmx.at> 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	other threads:[~2019-08-30  9:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25  4:04 bug#9867: 24.0.90; quit-window should provide quit-window-hook Christoph Scholtes
2019-08-20  2:22 ` Lars Ingebrigtsen
2019-08-20  8:19   ` martin rudalics
2019-08-20 14:25     ` Eli Zaretskii
2019-08-21 20:23       ` Lars Ingebrigtsen
2019-08-21 20:18     ` Lars Ingebrigtsen
2019-08-22  8:08       ` martin rudalics
2019-08-23  0:08         ` Lars Ingebrigtsen
2019-08-23  7:46           ` martin rudalics
2019-08-23  8:05             ` Lars Ingebrigtsen
2019-08-23  8:42               ` martin rudalics
2019-08-25  5:24                 ` Lars Ingebrigtsen
2019-08-25  8:11                   ` martin rudalics
2019-08-30  9:40                     ` Lars Ingebrigtsen [this message]

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=87sgpjhty9.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=9867@debbugs.gnu.org \
    --cc=cschol2112@googlemail.com \
    --cc=rudalics@gmx.at \
    /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.