[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)

Austin Clements amdragon at MIT.EDU
Thu Jan 12 09:02:44 PST 2012


Quoth Tomi Ollila on Jan 12 at 10:51 am:
> On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements <amdragon at mit.edu> wrote:
> > This is important to fix, but this solution seems needlessly
> > roundabout.  What about using an after-advice and simply delq'ing
> > whatever the offending hook is?  That wouldn't even need a version
> > check.
> 
> delq could work -- thanks for the idea -- but removing the hook was
> wrong shot from my part (the hook removes the cleanup I mentioned in
> one of my previous mails).

Ah, interesting.

> To minimise behaviour changes (to zero in emacs 23.3+) to minimal
> in 23.(1|2) my next suggestion goes along lines:
> 
> ;; Work around a bug in emacs 23.1 and emacs 23.2 which prevents
> ;; noninteractive (kill-emacs) from emacsclient.
> (when (and (= emacs-major-version 23) (< emacs-minor-version 3))
>   (defadvice kill-emacs (before disable-yes-or-no-p)
>     "Disable yes-or-no-p before executing kill-emacs"
>     (defun yes-or-no-p (prompt) t))
>   (ad-activate 'kill-emacs))

This seems reasonable.  You could shorten it a bit by changing
  (before disable-yes-or-no-p)
to
  (before disable-yes-or-no-p activate)
rather than calling ad-activate, but that's just a nit.

> Now just (accidental) additions which use yes-or-no-p 
> into kill-emacs-hook are not noticed in emacs 23.1 & 23.2.
> 
> 
> Tomi


More information about the notmuch mailing list