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

Austin Clements amdragon at MIT.EDU
Wed Jan 11 20:13:44 PST 2012


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.

Quoth Tomi Ollila on Jan 11 at  4:49 pm:
> emacsclient --eval '(kill-emacs)' doesn't work without interactive
> user input. By removing the hook which asks user input makes things
> work well enough in our test cases.
> ---
>  test/test-lib.el |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/test/test-lib.el b/test/test-lib.el
> index 3b817c3..c52854e 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -26,6 +26,19 @@
>  ;; `read' call.
>  (setq read-file-name-function (lambda (&rest _) (read)))
>  
> +;; 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))
> +  (require 'server)
> +  (fset 'server-start-real (symbol-function 'server-start))
> +  (defun server-start (&optional leave-dead)
> +    (interactive "P")
> +    (let ((hc (length kill-emacs-hook)))
> +      (unwind-protect
> +	  (server-start-real leave-dead)
> +	(if (> (length kill-emacs-hook) hc)
> +	    (setq kill-emacs-hook (cdr kill-emacs-hook)))))))
> +
>  (defun notmuch-test-wait ()
>    "Wait for process completion."
>    (while (get-buffer-process (current-buffer))


More information about the notmuch mailing list