comparison lisp/server.el @ 49206:7ebd98bb02a2

(server-process-filter): Use `minibufferp' to test whether we are inside a minibuffer. (server-process, server-kill-new-buffers): Doc fixes.
author John Paul Wallington <jpw@pobox.com>
date Mon, 13 Jan 2003 16:44:07 +0000
parents c9f452e277ea
children cc4646701e99
comparison
equal deleted inserted replaced
49205:5980231f9faa 49206:7ebd98bb02a2
42 ;; the server subprocess, and Emacs visits them and lets you edit them. 42 ;; the server subprocess, and Emacs visits them and lets you edit them.
43 43
44 ;; Note that any number of clients may dispatch files to emacs to be edited. 44 ;; Note that any number of clients may dispatch files to emacs to be edited.
45 45
46 ;; When you finish editing a Server buffer, again call server-edit 46 ;; When you finish editing a Server buffer, again call server-edit
47 ;; to mark that buffer as done for the client and switch to the next 47 ;; to mark that buffer as done for the client and switch to the next
48 ;; Server buffer. When all the buffers for a client have been edited 48 ;; Server buffer. When all the buffers for a client have been edited
49 ;; and exited with server-edit, the client "editor" will return 49 ;; and exited with server-edit, the client "editor" will return
50 ;; to the program that invoked it. 50 ;; to the program that invoked it.
51 51
52 ;; Your editing commands and Emacs's display output go to and from 52 ;; Your editing commands and Emacs's display output go to and from
53 ;; the terminal in the usual way. Thus, server operation is possible 53 ;; the terminal in the usual way. Thus, server operation is possible
54 ;; only when Emacs can talk to the terminal at the time you invoke 54 ;; only when Emacs can talk to the terminal at the time you invoke
55 ;; the client. This is possible in four cases: 55 ;; the client. This is possible in four cases:
67 ;; that wants to use "the editor" will stop and display 67 ;; that wants to use "the editor" will stop and display
68 ;; "Waiting for Emacs...". It can then be suspended, and Emacs can be 68 ;; "Waiting for Emacs...". It can then be suspended, and Emacs can be
69 ;; brought into the foreground for editing. When done editing, Emacs is 69 ;; brought into the foreground for editing. When done editing, Emacs is
70 ;; suspended again, and the client program is brought into the foreground. 70 ;; suspended again, and the client program is brought into the foreground.
71 71
72 ;; The buffer local variable "server-buffer-clients" lists 72 ;; The buffer local variable "server-buffer-clients" lists
73 ;; the clients who are waiting for this buffer to be edited. 73 ;; the clients who are waiting for this buffer to be edited.
74 ;; The global variable "server-clients" lists all the waiting clients, 74 ;; The global variable "server-clients" lists all the waiting clients,
75 ;; and which files are yet to be edited for each. 75 ;; and which files are yet to be edited for each.
76 76
77 ;;; Code: 77 ;;; Code:
78 78
95 (defcustom server-done-hook nil 95 (defcustom server-done-hook nil
96 "*Hook run when done editing a buffer for the Emacs server." 96 "*Hook run when done editing a buffer for the Emacs server."
97 :group 'server 97 :group 'server
98 :type 'hook) 98 :type 'hook)
99 99
100 (defvar server-process nil 100 (defvar server-process nil
101 "The current server process") 101 "The current server process.")
102 102
103 (defvar server-previous-strings nil) 103 (defvar server-previous-strings nil)
104 104
105 (defvar server-clients nil 105 (defvar server-clients nil
106 "List of current server clients. 106 "List of current server clients.
129 :type 'regexp) 129 :type 'regexp)
130 130
131 (defcustom server-kill-new-buffers t 131 (defcustom server-kill-new-buffers t
132 "*Whether to kill buffers when done with them. 132 "*Whether to kill buffers when done with them.
133 If non-nil, kill a buffer unless it already existed before editing 133 If non-nil, kill a buffer unless it already existed before editing
134 it with Emacs server. If nil, kill only buffers as specified by 134 it with Emacs server. If nil, kill only buffers as specified by
135 `server-temp-file-regexp'. 135 `server-temp-file-regexp'.
136 Please note that only buffers are killed that still have a client, 136 Please note that only buffers are killed that still have a client,
137 i.e. buffers visited which \"emacsclient --no-wait\" are never killed in 137 i.e. buffers visited which \"emacsclient --no-wait\" are never killed in
138 this way." 138 this way."
139 :group 'server 139 :group 'server
324 (progn 324 (progn
325 (delete-process proc) 325 (delete-process proc)
326 (server-log "Close empty client" proc)) 326 (server-log "Close empty client" proc))
327 ;; We visited some buffer for this client. 327 ;; We visited some buffer for this client.
328 (or nowait (push client server-clients)) 328 (or nowait (push client server-clients))
329 (unless (or isearch-mode (minibuffer-active)) 329 (unless (or isearch-mode (minibufferp))
330 (server-switch-buffer (nth 1 client)) 330 (server-switch-buffer (nth 1 client))
331 (run-hooks 'server-switch-hook) 331 (run-hooks 'server-switch-hook)
332 (unless nowait 332 (unless nowait
333 (message (substitute-command-keys 333 (message (substitute-command-keys
334 "When done with a buffer, type \\[server-edit]"))))))) 334 "When done with a buffer, type \\[server-edit]")))))))
520 no questions asked. (The variable `make-backup-files', if nil, still 520 no questions asked. (The variable `make-backup-files', if nil, still
521 inhibits a backup; you can set it locally in a particular buffer to 521 inhibits a backup; you can set it locally in a particular buffer to
522 prevent a backup for it.) The variable `server-temp-file-regexp' controls 522 prevent a backup for it.) The variable `server-temp-file-regexp' controls
523 which filenames are considered temporary. 523 which filenames are considered temporary.
524 524
525 If invoked with a prefix argument, or if there is no server process running, 525 If invoked with a prefix argument, or if there is no server process running,
526 starts server process and that is all. Invoked by \\[server-edit]." 526 starts server process and that is all. Invoked by \\[server-edit]."
527 (interactive "P") 527 (interactive "P")
528 (if (or arg 528 (if (or arg
529 (not server-process) 529 (not server-process)
530 (memq (process-status server-process) '(signal exit))) 530 (memq (process-status server-process) '(signal exit)))