[ Hi Chong, see below a question for you. ] > Could you try the patch below which sequentializes the processing of the > process-filters to avoid such recursion? Here's a new version of the patch which fixes various shortcomings I noticed while trying it out. Also it shortens the wait times after displaying a message by applying the `sit-for` principle of not waiting if there's some "pending input" (where I consider `emacsclient` processes to be pending inputs as well). This way, the `sit-for` waiting times don't accumulate so much. Also I noticed a weird thing in commit 2a847524ab57b1b3d6eaa7e12b96be52dbb79509 Author: Chong Yidong Date: Sat Oct 2 20:03:44 2010 -0400 * lisp/server.el (server-process-filter, server-return-error): Give emacsclient time to shut down after receiving an error string. * etc/NEWS: Document tweak to emacsclient exit status. [...] diff --git a/lisp/server.el b/lisp/server.el index 0f1b0219a2c..e661f055e1a 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -876,6 +876,9 @@ server-process-filter (server-log "Authentication failed" proc) (server-send-string proc (concat "-error " (server-quote-arg "Authentication failed"))) + ;; Before calling `delete-process', give emacsclient time to + ;; receive the error string and shut down on its own. + (sit-for 1) (delete-process proc) ;; We return immediately (return-from server-process-filter))) @@ -1129,6 +1132,9 @@ server-return-error proc (concat "-error " (server-quote-arg (error-message-string err)))) (server-log (error-message-string err) proc) + ;; Before calling `delete-process', give emacsclient time to + ;; receive the error string and shut down on its own. + (sit-for 5) (delete-process proc))) (defun server-goto-line-column (line-col) Why do we wait for 5s in one spot but 1s in another? Stefan