emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: emacsclient --eval has slightly counterintuititve be


From: Andrea Russo
Subject: Re: address@hidden: emacsclient --eval has slightly counterintuititve behaviour.]
Date: Sat, 04 Mar 2006 19:22:49 +0100

Hi,

This is my first attempt at fixing the code, I hope this is not too
heavyweight because of an evaluation of arbitrary code called inside a
condition-case form. It also doesn't take care of signaling emacslient
that an error condition occurred on the server.

I'm not an emacs expert, so this is the best I can do for now.
This at least avoid that emacsclient waits for input on the pipe.

Thanks,
Andrea.

--- orig/lisp/server.el
+++ mod/lisp/server.el
@@ -343,17 +343,17 @@
            (if coding-system
                (setq arg (decode-coding-string arg coding-system)))
            (if eval
-               (let ((v (eval (car (read-from-string arg)))))
-                 (when v
-                   (with-temp-buffer
-                     (let ((standard-output (current-buffer)))
-                       (pp v)
-                       ;; Suppress the error rose when the pipe to PROC is 
closed.
-                       (condition-case err
+               (condition-case err
+                   (let ((v (eval (car (read-from-string arg)))))
+                     (when v
+                       (with-temp-buffer
+                         (let ((standard-output (current-buffer)))
+                           (pp v)
+                           ;; Suppress the error rose when the pipe to PROC is 
closed.
                            (process-send-region proc (point-min) (point-max))
-                         (file-error nil)
-                         (error nil))
-                       ))))
+                         ))))
+                 (file-error nil)
+                 (error nil))
              ;; ARG is a file name.
              ;; Collapse multiple slashes to single slashes.
              (setq arg (command-line-normalize-file-name arg))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]