aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/server.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/server.el')
-rw-r--r--lisp/server.el26
1 files changed, 21 insertions, 5 deletions
diff --git a/lisp/server.el b/lisp/server.el
index 35b38ef8fa6..89aedc72d52 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1929,12 +1929,22 @@ This sets the variable `server-stop-automatically' (which see)."
1929 ;; continue standard unloading 1929 ;; continue standard unloading
1930 nil) 1930 nil)
1931 1931
1932(define-error 'server-return-invalid-read-syntax
1933 "Emacs server returned unreadable result of evaluation"
1934 'invalid-read-syntax)
1935
1932(defun server-eval-at (server form) 1936(defun server-eval-at (server form)
1933 "Contact the Emacs server named SERVER and evaluate FORM there. 1937 "Contact the Emacs server named SERVER and evaluate FORM there.
1934Returns the result of the evaluation, or signals an error if it 1938Returns the result of the evaluation. For example:
1935cannot contact the specified server. For example:
1936 (server-eval-at \"server\" \\='(emacs-pid)) 1939 (server-eval-at \"server\" \\='(emacs-pid))
1937returns the process ID of the Emacs instance running \"server\"." 1940returns the process ID of the Emacs instance running \"server\".
1941
1942This function signals `error' if it could not contact the server.
1943
1944This function signals `server-return-invalid-read-syntax' if it
1945couldn't read the result of evaluation printed by the server.
1946This will occur whenever the result of evaluating FORM is something
1947not readably printable."
1938 (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)) 1948 (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir))
1939 (server-file (expand-file-name server server-dir)) 1949 (server-file (expand-file-name server server-dir))
1940 (coding-system-for-read 'binary) 1950 (coding-system-for-read 'binary)
@@ -1980,8 +1990,14 @@ returns the process ID of the Emacs instance running \"server\"."
1980 (progn (skip-chars-forward "^\n") 1990 (progn (skip-chars-forward "^\n")
1981 (point)))))) 1991 (point))))))
1982 (if (not (equal answer "")) 1992 (if (not (equal answer ""))
1983 (read (decode-coding-string (server-unquote-arg answer) 1993 (condition-case err
1984 'emacs-internal))))))) 1994 (read
1995 (decode-coding-string (server-unquote-arg answer)
1996 'emacs-internal))
1997 ;; Re-signal with a more specific condition.
1998 (invalid-read-syntax
1999 (signal 'server-return-invalid-read-syntax
2000 (cdr err)))))))))
1985 2001
1986 2002
1987(provide 'server) 2003(provide 'server)