diff options
| author | Po Lu | 2023-03-09 09:27:12 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-09 09:27:12 +0800 |
| commit | 5e3bba2dbe32ffdfd5fadceade08a365be2bb11a (patch) | |
| tree | 4149d7bdb065f0d4a2b7b9375a20ffe696996b40 /lisp/server.el | |
| parent | 1bf8fd61c5c4781a4f00ea4a4465915c04dcb659 (diff) | |
| parent | da4f1fa550f753e76c611b313d4f00987daed5ad (diff) | |
| download | emacs-5e3bba2dbe32ffdfd5fadceade08a365be2bb11a.tar.gz emacs-5e3bba2dbe32ffdfd5fadceade08a365be2bb11a.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'lisp/server.el')
| -rw-r--r-- | lisp/server.el | 26 |
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. |
| 1934 | Returns the result of the evaluation, or signals an error if it | 1938 | Returns the result of the evaluation. For example: |
| 1935 | cannot contact the specified server. For example: | ||
| 1936 | (server-eval-at \"server\" \\='(emacs-pid)) | 1939 | (server-eval-at \"server\" \\='(emacs-pid)) |
| 1937 | returns the process ID of the Emacs instance running \"server\"." | 1940 | returns the process ID of the Emacs instance running \"server\". |
| 1941 | |||
| 1942 | This function signals `error' if it could not contact the server. | ||
| 1943 | |||
| 1944 | This function signals `server-return-invalid-read-syntax' if it | ||
| 1945 | couldn't read the result of evaluation printed by the server. | ||
| 1946 | This will occur whenever the result of evaluating FORM is something | ||
| 1947 | not 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) |