diff options
| author | Igor Kuzmin | 2011-02-10 13:53:49 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-02-10 13:53:49 -0500 |
| commit | 94d11cb5773b3b37367ee3c4885a374ff129d475 (patch) | |
| tree | b7acbbd87cfce602ad52c23f4434a3b27eac83e1 /lisp/server.el | |
| parent | 8f1d2ef658f95549eb33fe5265f8f11c5129bece (diff) | |
| download | emacs-94d11cb5773b3b37367ee3c4885a374ff129d475.tar.gz emacs-94d11cb5773b3b37367ee3c4885a374ff129d475.zip | |
* lisp/emacs-lisp/cconv.el: New file.
* lisp/emacs-lisp/bytecomp.el: Use cconv.
(byte-compile-file-form, byte-compile):
Call cconv-closure-convert-toplevel when requested.
* lisp/server.el:
* lisp/mpc.el:
* lisp/emacs-lisp/pcase.el:
* lisp/doc-view.el:
* lisp/dired.el: Use lexical-binding.
Diffstat (limited to 'lisp/server.el')
| -rw-r--r-- | lisp/server.el | 344 |
1 files changed, 168 insertions, 176 deletions
diff --git a/lisp/server.el b/lisp/server.el index 62c59b41cee..1ee30f5bc3c 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | ;;; -*- lexical-binding: t -*- | ||
| 1 | ;;; server.el --- Lisp code for GNU Emacs running as server process | 2 | ;;; server.el --- Lisp code for GNU Emacs running as server process |
| 2 | 3 | ||
| 3 | ;; Copyright (C) 1986-1987, 1992, 1994-2011 Free Software Foundation, Inc. | 4 | ;; Copyright (C) 1986-1987, 1992, 1994-2011 Free Software Foundation, Inc. |
| @@ -335,9 +336,9 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 335 | (goto-char (point-max)) | 336 | (goto-char (point-max)) |
| 336 | (insert (funcall server-log-time-function) | 337 | (insert (funcall server-log-time-function) |
| 337 | (cond | 338 | (cond |
| 338 | ((null client) " ") | 339 | ((null client) " ") |
| 339 | ((listp client) (format " %s: " (car client))) | 340 | ((listp client) (format " %s: " (car client))) |
| 340 | (t (format " %s: " client))) | 341 | (t (format " %s: " client))) |
| 341 | string) | 342 | string) |
| 342 | (or (bolp) (newline))))) | 343 | (or (bolp) (newline))))) |
| 343 | 344 | ||
| @@ -355,7 +356,7 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 355 | (and (process-contact proc :server) | 356 | (and (process-contact proc :server) |
| 356 | (eq (process-status proc) 'closed) | 357 | (eq (process-status proc) 'closed) |
| 357 | (ignore-errors | 358 | (ignore-errors |
| 358 | (delete-file (process-get proc :server-file)))) | 359 | (delete-file (process-get proc :server-file)))) |
| 359 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) | 360 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) |
| 360 | (server-delete-client proc)) | 361 | (server-delete-client proc)) |
| 361 | 362 | ||
| @@ -410,10 +411,10 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 410 | proc | 411 | proc |
| 411 | ;; See if this is the last frame for this client. | 412 | ;; See if this is the last frame for this client. |
| 412 | (>= 1 (let ((frame-num 0)) | 413 | (>= 1 (let ((frame-num 0)) |
| 413 | (dolist (f (frame-list)) | 414 | (dolist (f (frame-list)) |
| 414 | (when (eq proc (frame-parameter f 'client)) | 415 | (when (eq proc (frame-parameter f 'client)) |
| 415 | (setq frame-num (1+ frame-num)))) | 416 | (setq frame-num (1+ frame-num)))) |
| 416 | frame-num))) | 417 | frame-num))) |
| 417 | (server-log (format "server-handle-delete-frame, frame %s" frame) proc) | 418 | (server-log (format "server-handle-delete-frame, frame %s" frame) proc) |
| 418 | (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later. | 419 | (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later. |
| 419 | 420 | ||
| @@ -534,8 +535,8 @@ To force-start a server, do \\[server-force-delete] and then | |||
| 534 | (if (not (eq t (server-running-p server-name))) | 535 | (if (not (eq t (server-running-p server-name))) |
| 535 | ;; Remove any leftover socket or authentication file | 536 | ;; Remove any leftover socket or authentication file |
| 536 | (ignore-errors | 537 | (ignore-errors |
| 537 | (let (delete-by-moving-to-trash) | 538 | (let (delete-by-moving-to-trash) |
| 538 | (delete-file server-file))) | 539 | (delete-file server-file))) |
| 539 | (setq server-mode nil) ;; already set by the minor mode code | 540 | (setq server-mode nil) ;; already set by the minor mode code |
| 540 | (display-warning | 541 | (display-warning |
| 541 | 'server | 542 | 'server |
| @@ -590,11 +591,11 @@ server or call `M-x server-force-delete' to forcibly disconnect it.") | |||
| 590 | (when server-use-tcp | 591 | (when server-use-tcp |
| 591 | (let ((auth-key | 592 | (let ((auth-key |
| 592 | (loop | 593 | (loop |
| 593 | ;; The auth key is a 64-byte string of random chars in the | 594 | ;; The auth key is a 64-byte string of random chars in the |
| 594 | ;; range `!'..`~'. | 595 | ;; range `!'..`~'. |
| 595 | repeat 64 | 596 | repeat 64 |
| 596 | collect (+ 33 (random 94)) into auth | 597 | collect (+ 33 (random 94)) into auth |
| 597 | finally return (concat auth)))) | 598 | finally return (concat auth)))) |
| 598 | (process-put server-process :auth-key auth-key) | 599 | (process-put server-process :auth-key auth-key) |
| 599 | (with-temp-file server-file | 600 | (with-temp-file server-file |
| 600 | (set-buffer-multibyte nil) | 601 | (set-buffer-multibyte nil) |
| @@ -689,31 +690,31 @@ Server mode runs a process that accepts commands from the | |||
| 689 | (add-to-list 'frame-inherited-parameters 'client) | 690 | (add-to-list 'frame-inherited-parameters 'client) |
| 690 | (let ((frame | 691 | (let ((frame |
| 691 | (server-with-environment (process-get proc 'env) | 692 | (server-with-environment (process-get proc 'env) |
| 692 | '("LANG" "LC_CTYPE" "LC_ALL" | 693 | '("LANG" "LC_CTYPE" "LC_ALL" |
| 693 | ;; For tgetent(3); list according to ncurses(3). | 694 | ;; For tgetent(3); list according to ncurses(3). |
| 694 | "BAUDRATE" "COLUMNS" "ESCDELAY" "HOME" "LINES" | 695 | "BAUDRATE" "COLUMNS" "ESCDELAY" "HOME" "LINES" |
| 695 | "NCURSES_ASSUMED_COLORS" "NCURSES_NO_PADDING" | 696 | "NCURSES_ASSUMED_COLORS" "NCURSES_NO_PADDING" |
| 696 | "NCURSES_NO_SETBUF" "TERM" "TERMCAP" "TERMINFO" | 697 | "NCURSES_NO_SETBUF" "TERM" "TERMCAP" "TERMINFO" |
| 697 | "TERMINFO_DIRS" "TERMPATH" | 698 | "TERMINFO_DIRS" "TERMPATH" |
| 698 | ;; rxvt wants these | 699 | ;; rxvt wants these |
| 699 | "COLORFGBG" "COLORTERM") | 700 | "COLORFGBG" "COLORTERM") |
| 700 | (make-frame `((window-system . nil) | 701 | (make-frame `((window-system . nil) |
| 701 | (tty . ,tty) | 702 | (tty . ,tty) |
| 702 | (tty-type . ,type) | 703 | (tty-type . ,type) |
| 703 | ;; Ignore nowait here; we always need to | 704 | ;; Ignore nowait here; we always need to |
| 704 | ;; clean up opened ttys when the client dies. | 705 | ;; clean up opened ttys when the client dies. |
| 705 | (client . ,proc) | 706 | (client . ,proc) |
| 706 | ;; This is a leftover from an earlier | 707 | ;; This is a leftover from an earlier |
| 707 | ;; attempt at making it possible for process | 708 | ;; attempt at making it possible for process |
| 708 | ;; run in the server process to use the | 709 | ;; run in the server process to use the |
| 709 | ;; environment of the client process. | 710 | ;; environment of the client process. |
| 710 | ;; It has no effect now and to make it work | 711 | ;; It has no effect now and to make it work |
| 711 | ;; we'd need to decide how to make | 712 | ;; we'd need to decide how to make |
| 712 | ;; process-environment interact with client | 713 | ;; process-environment interact with client |
| 713 | ;; envvars, and then to change the | 714 | ;; envvars, and then to change the |
| 714 | ;; C functions `child_setup' and | 715 | ;; C functions `child_setup' and |
| 715 | ;; `getenv_internal' accordingly. | 716 | ;; `getenv_internal' accordingly. |
| 716 | (environment . ,(process-get proc 'env))))))) | 717 | (environment . ,(process-get proc 'env))))))) |
| 717 | 718 | ||
| 718 | ;; ttys don't use the `display' parameter, but callproc.c does to set | 719 | ;; ttys don't use the `display' parameter, but callproc.c does to set |
| 719 | ;; the DISPLAY environment on subprocesses. | 720 | ;; the DISPLAY environment on subprocesses. |
| @@ -777,8 +778,7 @@ Server mode runs a process that accepts commands from the | |||
| 777 | ;; frame because input from that display will be blocked (until exiting | 778 | ;; frame because input from that display will be blocked (until exiting |
| 778 | ;; the minibuffer). Better exit this minibuffer right away. | 779 | ;; the minibuffer). Better exit this minibuffer right away. |
| 779 | ;; Similarly with recursive-edits such as the splash screen. | 780 | ;; Similarly with recursive-edits such as the splash screen. |
| 780 | (run-with-timer 0 nil (lexical-let ((proc proc)) | 781 | (run-with-timer 0 nil (lambda () (server-execute-continuation proc))) |
| 781 | (lambda () (server-execute-continuation proc)))) | ||
| 782 | (top-level))) | 782 | (top-level))) |
| 783 | 783 | ||
| 784 | ;; We use various special properties on process objects: | 784 | ;; We use various special properties on process objects: |
| @@ -944,119 +944,119 @@ The following commands are accepted by the client: | |||
| 944 | (setq command-line-args-left | 944 | (setq command-line-args-left |
| 945 | (mapcar 'server-unquote-arg (split-string request " " t))) | 945 | (mapcar 'server-unquote-arg (split-string request " " t))) |
| 946 | (while (setq arg (pop command-line-args-left)) | 946 | (while (setq arg (pop command-line-args-left)) |
| 947 | (cond | 947 | (cond |
| 948 | ;; -version CLIENT-VERSION: obsolete at birth. | 948 | ;; -version CLIENT-VERSION: obsolete at birth. |
| 949 | ((and (equal "-version" arg) command-line-args-left) | 949 | ((and (equal "-version" arg) command-line-args-left) |
| 950 | (pop command-line-args-left)) | 950 | (pop command-line-args-left)) |
| 951 | 951 | ||
| 952 | ;; -nowait: Emacsclient won't wait for a result. | 952 | ;; -nowait: Emacsclient won't wait for a result. |
| 953 | ((equal "-nowait" arg) (setq nowait t)) | 953 | ((equal "-nowait" arg) (setq nowait t)) |
| 954 | 954 | ||
| 955 | ;; -current-frame: Don't create frames. | 955 | ;; -current-frame: Don't create frames. |
| 956 | ((equal "-current-frame" arg) (setq use-current-frame t)) | 956 | ((equal "-current-frame" arg) (setq use-current-frame t)) |
| 957 | 957 | ||
| 958 | ;; -display DISPLAY: | 958 | ;; -display DISPLAY: |
| 959 | ;; Open X frames on the given display instead of the default. | 959 | ;; Open X frames on the given display instead of the default. |
| 960 | ((and (equal "-display" arg) command-line-args-left) | 960 | ((and (equal "-display" arg) command-line-args-left) |
| 961 | (setq display (pop command-line-args-left)) | 961 | (setq display (pop command-line-args-left)) |
| 962 | (if (zerop (length display)) (setq display nil))) | 962 | (if (zerop (length display)) (setq display nil))) |
| 963 | 963 | ||
| 964 | ;; -parent-id ID: | 964 | ;; -parent-id ID: |
| 965 | ;; Open X frame within window ID, via XEmbed. | 965 | ;; Open X frame within window ID, via XEmbed. |
| 966 | ((and (equal "-parent-id" arg) command-line-args-left) | 966 | ((and (equal "-parent-id" arg) command-line-args-left) |
| 967 | (setq parent-id (pop command-line-args-left)) | 967 | (setq parent-id (pop command-line-args-left)) |
| 968 | (if (zerop (length parent-id)) (setq parent-id nil))) | 968 | (if (zerop (length parent-id)) (setq parent-id nil))) |
| 969 | 969 | ||
| 970 | ;; -window-system: Open a new X frame. | 970 | ;; -window-system: Open a new X frame. |
| 971 | ((equal "-window-system" arg) | 971 | ((equal "-window-system" arg) |
| 972 | (setq dontkill t) | 972 | (setq dontkill t) |
| 973 | (setq tty-name 'window-system)) | 973 | (setq tty-name 'window-system)) |
| 974 | 974 | ||
| 975 | ;; -resume: Resume a suspended tty frame. | 975 | ;; -resume: Resume a suspended tty frame. |
| 976 | ((equal "-resume" arg) | 976 | ((equal "-resume" arg) |
| 977 | (lexical-let ((terminal (process-get proc 'terminal))) | 977 | (let ((terminal (process-get proc 'terminal))) |
| 978 | (setq dontkill t) | 978 | (setq dontkill t) |
| 979 | (push (lambda () | 979 | (push (lambda () |
| 980 | (when (eq (terminal-live-p terminal) t) | 980 | (when (eq (terminal-live-p terminal) t) |
| 981 | (resume-tty terminal))) | 981 | (resume-tty terminal))) |
| 982 | commands))) | 982 | commands))) |
| 983 | 983 | ||
| 984 | ;; -suspend: Suspend the client's frame. (In case we | 984 | ;; -suspend: Suspend the client's frame. (In case we |
| 985 | ;; get out of sync, and a C-z sends a SIGTSTP to | 985 | ;; get out of sync, and a C-z sends a SIGTSTP to |
| 986 | ;; emacsclient.) | 986 | ;; emacsclient.) |
| 987 | ((equal "-suspend" arg) | 987 | ((equal "-suspend" arg) |
| 988 | (lexical-let ((terminal (process-get proc 'terminal))) | 988 | (let ((terminal (process-get proc 'terminal))) |
| 989 | (setq dontkill t) | ||
| 990 | (push (lambda () | ||
| 991 | (when (eq (terminal-live-p terminal) t) | ||
| 992 | (suspend-tty terminal))) | ||
| 993 | commands))) | ||
| 994 | |||
| 995 | ;; -ignore COMMENT: Noop; useful for debugging emacsclient. | ||
| 996 | ;; (The given comment appears in the server log.) | ||
| 997 | ((and (equal "-ignore" arg) command-line-args-left | ||
| 998 | (setq dontkill t) | 989 | (setq dontkill t) |
| 999 | (pop command-line-args-left))) | 990 | (push (lambda () |
| 1000 | 991 | (when (eq (terminal-live-p terminal) t) | |
| 1001 | ;; -tty DEVICE-NAME TYPE: Open a new tty frame at the client. | 992 | (suspend-tty terminal))) |
| 1002 | ((and (equal "-tty" arg) | 993 | commands))) |
| 1003 | (cdr command-line-args-left)) | 994 | |
| 1004 | (setq tty-name (pop command-line-args-left) | 995 | ;; -ignore COMMENT: Noop; useful for debugging emacsclient. |
| 1005 | tty-type (pop command-line-args-left) | 996 | ;; (The given comment appears in the server log.) |
| 1006 | dontkill (or dontkill | 997 | ((and (equal "-ignore" arg) command-line-args-left |
| 1007 | (not use-current-frame)))) | 998 | (setq dontkill t) |
| 1008 | 999 | (pop command-line-args-left))) | |
| 1009 | ;; -position LINE[:COLUMN]: Set point to the given | 1000 | |
| 1010 | ;; position in the next file. | 1001 | ;; -tty DEVICE-NAME TYPE: Open a new tty frame at the client. |
| 1011 | ((and (equal "-position" arg) | 1002 | ((and (equal "-tty" arg) |
| 1012 | command-line-args-left | 1003 | (cdr command-line-args-left)) |
| 1013 | (string-match "\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?" | 1004 | (setq tty-name (pop command-line-args-left) |
| 1014 | (car command-line-args-left))) | 1005 | tty-type (pop command-line-args-left) |
| 1015 | (setq arg (pop command-line-args-left)) | 1006 | dontkill (or dontkill |
| 1016 | (setq filepos | 1007 | (not use-current-frame)))) |
| 1017 | (cons (string-to-number (match-string 1 arg)) | 1008 | |
| 1018 | (string-to-number (or (match-string 2 arg) ""))))) | 1009 | ;; -position LINE[:COLUMN]: Set point to the given |
| 1019 | 1010 | ;; position in the next file. | |
| 1020 | ;; -file FILENAME: Load the given file. | 1011 | ((and (equal "-position" arg) |
| 1021 | ((and (equal "-file" arg) | 1012 | command-line-args-left |
| 1022 | command-line-args-left) | 1013 | (string-match "\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?" |
| 1023 | (let ((file (pop command-line-args-left))) | 1014 | (car command-line-args-left))) |
| 1024 | (if coding-system | 1015 | (setq arg (pop command-line-args-left)) |
| 1025 | (setq file (decode-coding-string file coding-system))) | 1016 | (setq filepos |
| 1026 | (setq file (expand-file-name file dir)) | 1017 | (cons (string-to-number (match-string 1 arg)) |
| 1027 | (push (cons file filepos) files) | 1018 | (string-to-number (or (match-string 2 arg) ""))))) |
| 1028 | (server-log (format "New file: %s %s" | 1019 | |
| 1029 | file (or filepos "")) proc)) | 1020 | ;; -file FILENAME: Load the given file. |
| 1030 | (setq filepos nil)) | 1021 | ((and (equal "-file" arg) |
| 1031 | 1022 | command-line-args-left) | |
| 1032 | ;; -eval EXPR: Evaluate a Lisp expression. | 1023 | (let ((file (pop command-line-args-left))) |
| 1033 | ((and (equal "-eval" arg) | ||
| 1034 | command-line-args-left) | ||
| 1035 | (if use-current-frame | ||
| 1036 | (setq use-current-frame 'always)) | ||
| 1037 | (lexical-let ((expr (pop command-line-args-left))) | ||
| 1038 | (if coding-system | ||
| 1039 | (setq expr (decode-coding-string expr coding-system))) | ||
| 1040 | (push (lambda () (server-eval-and-print expr proc)) | ||
| 1041 | commands) | ||
| 1042 | (setq filepos nil))) | ||
| 1043 | |||
| 1044 | ;; -env NAME=VALUE: An environment variable. | ||
| 1045 | ((and (equal "-env" arg) command-line-args-left) | ||
| 1046 | (let ((var (pop command-line-args-left))) | ||
| 1047 | ;; XXX Variables should be encoded as in getenv/setenv. | ||
| 1048 | (process-put proc 'env | ||
| 1049 | (cons var (process-get proc 'env))))) | ||
| 1050 | |||
| 1051 | ;; -dir DIRNAME: The cwd of the emacsclient process. | ||
| 1052 | ((and (equal "-dir" arg) command-line-args-left) | ||
| 1053 | (setq dir (pop command-line-args-left)) | ||
| 1054 | (if coding-system | 1024 | (if coding-system |
| 1055 | (setq dir (decode-coding-string dir coding-system))) | 1025 | (setq file (decode-coding-string file coding-system))) |
| 1056 | (setq dir (command-line-normalize-file-name dir))) | 1026 | (setq file (expand-file-name file dir)) |
| 1057 | 1027 | (push (cons file filepos) files) | |
| 1058 | ;; Unknown command. | 1028 | (server-log (format "New file: %s %s" |
| 1059 | (t (error "Unknown command: %s" arg)))) | 1029 | file (or filepos "")) proc)) |
| 1030 | (setq filepos nil)) | ||
| 1031 | |||
| 1032 | ;; -eval EXPR: Evaluate a Lisp expression. | ||
| 1033 | ((and (equal "-eval" arg) | ||
| 1034 | command-line-args-left) | ||
| 1035 | (if use-current-frame | ||
| 1036 | (setq use-current-frame 'always)) | ||
| 1037 | (let ((expr (pop command-line-args-left))) | ||
| 1038 | (if coding-system | ||
| 1039 | (setq expr (decode-coding-string expr coding-system))) | ||
| 1040 | (push (lambda () (server-eval-and-print expr proc)) | ||
| 1041 | commands) | ||
| 1042 | (setq filepos nil))) | ||
| 1043 | |||
| 1044 | ;; -env NAME=VALUE: An environment variable. | ||
| 1045 | ((and (equal "-env" arg) command-line-args-left) | ||
| 1046 | (let ((var (pop command-line-args-left))) | ||
| 1047 | ;; XXX Variables should be encoded as in getenv/setenv. | ||
| 1048 | (process-put proc 'env | ||
| 1049 | (cons var (process-get proc 'env))))) | ||
| 1050 | |||
| 1051 | ;; -dir DIRNAME: The cwd of the emacsclient process. | ||
| 1052 | ((and (equal "-dir" arg) command-line-args-left) | ||
| 1053 | (setq dir (pop command-line-args-left)) | ||
| 1054 | (if coding-system | ||
| 1055 | (setq dir (decode-coding-string dir coding-system))) | ||
| 1056 | (setq dir (command-line-normalize-file-name dir))) | ||
| 1057 | |||
| 1058 | ;; Unknown command. | ||
| 1059 | (t (error "Unknown command: %s" arg)))) | ||
| 1060 | 1060 | ||
| 1061 | (setq frame | 1061 | (setq frame |
| 1062 | (cond | 1062 | (cond |
| @@ -1079,23 +1079,15 @@ The following commands are accepted by the client: | |||
| 1079 | 1079 | ||
| 1080 | (process-put | 1080 | (process-put |
| 1081 | proc 'continuation | 1081 | proc 'continuation |
| 1082 | (lexical-let ((proc proc) | 1082 | (lambda () |
| 1083 | (files files) | 1083 | (with-current-buffer (get-buffer-create server-buffer) |
| 1084 | (nowait nowait) | 1084 | ;; Use the same cwd as the emacsclient, if possible, so |
| 1085 | (commands commands) | 1085 | ;; relative file names work correctly, even in `eval'. |
| 1086 | (dontkill dontkill) | 1086 | (let ((default-directory |
| 1087 | (frame frame) | 1087 | (if (and dir (file-directory-p dir)) |
| 1088 | (dir dir) | 1088 | dir default-directory))) |
| 1089 | (tty-name tty-name)) | 1089 | (server-execute proc files nowait commands |
| 1090 | (lambda () | 1090 | dontkill frame tty-name))))) |
| 1091 | (with-current-buffer (get-buffer-create server-buffer) | ||
| 1092 | ;; Use the same cwd as the emacsclient, if possible, so | ||
| 1093 | ;; relative file names work correctly, even in `eval'. | ||
| 1094 | (let ((default-directory | ||
| 1095 | (if (and dir (file-directory-p dir)) | ||
| 1096 | dir default-directory))) | ||
| 1097 | (server-execute proc files nowait commands | ||
| 1098 | dontkill frame tty-name)))))) | ||
| 1099 | 1091 | ||
| 1100 | (when (or frame files) | 1092 | (when (or frame files) |
| 1101 | (server-goto-toplevel proc)) | 1093 | (server-goto-toplevel proc)) |
| @@ -1372,12 +1364,12 @@ If invoked with a prefix argument, or if there is no server process running, | |||
| 1372 | starts server process and that is all. Invoked by \\[server-edit]." | 1364 | starts server process and that is all. Invoked by \\[server-edit]." |
| 1373 | (interactive "P") | 1365 | (interactive "P") |
| 1374 | (cond | 1366 | (cond |
| 1375 | ((or arg | 1367 | ((or arg |
| 1376 | (not server-process) | 1368 | (not server-process) |
| 1377 | (memq (process-status server-process) '(signal exit))) | 1369 | (memq (process-status server-process) '(signal exit))) |
| 1378 | (server-mode 1)) | 1370 | (server-mode 1)) |
| 1379 | (server-clients (apply 'server-switch-buffer (server-done))) | 1371 | (server-clients (apply 'server-switch-buffer (server-done))) |
| 1380 | (t (message "No server editing buffers exist")))) | 1372 | (t (message "No server editing buffers exist")))) |
| 1381 | 1373 | ||
| 1382 | (defun server-switch-buffer (&optional next-buffer killed-one filepos) | 1374 | (defun server-switch-buffer (&optional next-buffer killed-one filepos) |
| 1383 | "Switch to another buffer, preferably one that has a client. | 1375 | "Switch to another buffer, preferably one that has a client. |