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

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

Date: Thu, 12 Jan 2012 10:51:42 +0200

To: Austin Clements, Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements <amdragon@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).

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))

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


Tomi

Thread: