Mercurial > emacs
changeset 101874:76d5e3386e23
(server-execute): Enable quit.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 07 Feb 2009 16:24:36 +0000 |
parents | 5cb3814c8e09 |
children | 595dd77c0199 |
files | lisp/ChangeLog lisp/server.el |
diffstat | 2 files changed, 45 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Feb 07 15:29:11 2009 +0000 +++ b/lisp/ChangeLog Sat Feb 07 16:24:36 2009 +0000 @@ -1,3 +1,7 @@ +2009-02-07 Stefan Monnier <monnier@iro.umontreal.ca> + + * server.el (server-execute): Enable quit. + 2009-02-07 Andreas Schwab <schwab@suse.de> * image-mode.el (image-mode): Always set image-type. @@ -19,8 +23,8 @@ * mail/rmailedit.el (rmail-cease-edit): narrow-to-region before extracting mail message headers. Use encode-coding-region instead - of insert-buffer-substring for re-encoding edited message. Add - qp/b64 encoding only after text was encoded. + of insert-buffer-substring for re-encoding edited message. + Add qp/b64 encoding only after text was encoded. 2009-02-07 Eli Zaretskii <eliz@gnu.org>
--- a/lisp/server.el Sat Feb 07 15:29:11 2009 +0000 +++ b/lisp/server.el Sat Feb 07 16:24:36 2009 +0000 @@ -1036,40 +1036,48 @@ (error (server-return-error proc err)))) (defun server-execute (proc files nowait commands dontkill frame tty-name) - (condition-case err - (let* ((buffers - (when files - (run-hooks 'pre-command-hook) - (prog1 (server-visit-files files proc nowait) - (run-hooks 'post-command-hook))))) + ;; This is run from timers and process-filters, i.e. "asynchronously". + ;; But w.r.t the user, this is not really asynchronous since the timer + ;; is run after 0s and the process-filter is run in response to the + ;; user running `emacsclient'. So it is OK to override the + ;; inhibit-quit flag, which is good since `commands' (as well as + ;; find-file-noselect via the major-mode) can run arbitrary code, + ;; including code that needs to wait. + (with-local-quit + (condition-case err + (let* ((buffers + (when files + (run-hooks 'pre-command-hook) + (prog1 (server-visit-files files proc nowait) + (run-hooks 'post-command-hook))))) - (mapc 'funcall (nreverse commands)) + (mapc 'funcall (nreverse commands)) - ;; Delete the client if necessary. - (cond - (nowait - ;; Client requested nowait; return immediately. - (server-log "Close nowait client" proc) - (server-delete-client proc)) - ((and (not dontkill) (null buffers)) - ;; This client is empty; get rid of it immediately. - (server-log "Close empty client" proc) - (server-delete-client proc))) - (cond - ((or isearch-mode (minibufferp)) - nil) - ((and frame (null buffers)) - (message "%s" (substitute-command-keys - "When done with this frame, type \\[delete-frame]"))) - ((not (null buffers)) - (server-switch-buffer (car buffers) nil (cdr (car files))) - (run-hooks 'server-switch-hook) - (unless nowait + ;; Delete the client if necessary. + (cond + (nowait + ;; Client requested nowait; return immediately. + (server-log "Close nowait client" proc) + (server-delete-client proc)) + ((and (not dontkill) (null buffers)) + ;; This client is empty; get rid of it immediately. + (server-log "Close empty client" proc) + (server-delete-client proc))) + (cond + ((or isearch-mode (minibufferp)) + nil) + ((and frame (null buffers)) (message "%s" (substitute-command-keys - "When done with a buffer, type \\[server-edit]"))))) - (when (and frame (null tty-name)) - (server-unselect-display frame))) - (error (server-return-error proc err)))) + "When done with this frame, type \\[delete-frame]"))) + ((not (null buffers)) + (server-switch-buffer (car buffers) nil (cdr (car files))) + (run-hooks 'server-switch-hook) + (unless nowait + (message "%s" (substitute-command-keys + "When done with a buffer, type \\[server-edit]"))))) + (when (and frame (null tty-name)) + (server-unselect-display frame))) + (error (server-return-error proc err))))) (defun server-return-error (proc err) (ignore-errors