[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
Quoth Tomi Ollila on Jan 12 at 10:51 am: > On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements > 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
[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements 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
Re: [PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements amdra...@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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
Quoth Tomi Ollila on Jan 12 at 10:51 am: On Wed, 11 Jan 2012 23:13:44 -0500, Austin Clements amdra...@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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
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 ( _) (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 ( 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))
[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
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 ( _) (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 ( 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)) -- 1.7.7.3
[PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
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)) -- 1.7.7.3 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] make (kill-emacs) from emacsclient work with emacs 23.(1|2)
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)) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch