comparison lisp/server.el @ 74268:3de22dfd43f8

Remove spurious * in docstrings. (server-process-filter): Exit from recursive editing before processing a new request.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 27 Nov 2006 20:58:37 +0000
parents f4ca1a5d7df7
children 54c43f5d4c8b c71725faff1a f1d13e615070
comparison
equal deleted inserted replaced
74267:8823864c534b 74268:3de22dfd43f8
111 :type 'directory 111 :type 'directory
112 :version "22.1") 112 :version "22.1")
113 (put 'server-auth-dir 'risky-local-variable t) 113 (put 'server-auth-dir 'risky-local-variable t)
114 114
115 (defcustom server-raise-frame t 115 (defcustom server-raise-frame t
116 "*If non-nil, raise frame when switching to a buffer." 116 "If non-nil, raise frame when switching to a buffer."
117 :group 'server 117 :group 'server
118 :type 'boolean 118 :type 'boolean
119 :version "22.1") 119 :version "22.1")
120 120
121 (defcustom server-visit-hook nil 121 (defcustom server-visit-hook nil
122 "*Hook run when visiting a file for the Emacs server." 122 "Hook run when visiting a file for the Emacs server."
123 :group 'server 123 :group 'server
124 :type 'hook) 124 :type 'hook)
125 125
126 (defcustom server-switch-hook nil 126 (defcustom server-switch-hook nil
127 "*Hook run when switching to a buffer for the Emacs server." 127 "Hook run when switching to a buffer for the Emacs server."
128 :group 'server 128 :group 'server
129 :type 'hook) 129 :type 'hook)
130 130
131 (defcustom server-done-hook nil 131 (defcustom server-done-hook nil
132 "*Hook run when done editing a buffer for the Emacs server." 132 "Hook run when done editing a buffer for the Emacs server."
133 :group 'server 133 :group 'server
134 :type 'hook) 134 :type 'hook)
135 135
136 (defvar server-process nil 136 (defvar server-process nil
137 "The current server process.") 137 "The current server process.")
147 (make-variable-buffer-local 'server-buffer-clients) 147 (make-variable-buffer-local 'server-buffer-clients)
148 ;; Changing major modes should not erase this local. 148 ;; Changing major modes should not erase this local.
149 (put 'server-buffer-clients 'permanent-local t) 149 (put 'server-buffer-clients 'permanent-local t)
150 150
151 (defcustom server-window nil 151 (defcustom server-window nil
152 "*Specification of the window to use for selecting Emacs server buffers. 152 "Specification of the window to use for selecting Emacs server buffers.
153 If nil, use the selected window. 153 If nil, use the selected window.
154 If it is a function, it should take one argument (a buffer) and 154 If it is a function, it should take one argument (a buffer) and
155 display and select it. A common value is `pop-to-buffer'. 155 display and select it. A common value is `pop-to-buffer'.
156 If it is a window, use that. 156 If it is a window, use that.
157 If it is a frame, use the frame's selected window. 157 If it is a frame, use the frame's selected window.
166 nil) 166 nil)
167 (function-item :tag "Use pop-to-buffer" pop-to-buffer) 167 (function-item :tag "Use pop-to-buffer" pop-to-buffer)
168 (function :tag "Other function"))) 168 (function :tag "Other function")))
169 169
170 (defcustom server-temp-file-regexp "^/tmp/Re\\|/draft$" 170 (defcustom server-temp-file-regexp "^/tmp/Re\\|/draft$"
171 "*Regexp matching names of temporary files. 171 "Regexp matching names of temporary files.
172 These are deleted and reused after each edit by the programs that 172 These are deleted and reused after each edit by the programs that
173 invoke the Emacs server." 173 invoke the Emacs server."
174 :group 'server 174 :group 'server
175 :type 'regexp) 175 :type 'regexp)
176 176
177 (defcustom server-kill-new-buffers t 177 (defcustom server-kill-new-buffers t
178 "*Whether to kill buffers when done with them. 178 "Whether to kill buffers when done with them.
179 If non-nil, kill a buffer unless it already existed before editing 179 If non-nil, kill a buffer unless it already existed before editing
180 it with Emacs server. If nil, kill only buffers as specified by 180 it with Emacs server. If nil, kill only buffers as specified by
181 `server-temp-file-regexp'. 181 `server-temp-file-regexp'.
182 Please note that only buffers are killed that still have a client, 182 Please note that only buffers are killed that still have a client,
183 i.e. buffers visited which \"emacsclient --no-wait\" are never killed in 183 i.e. buffers visited which \"emacsclient --no-wait\" are never killed in
401 (server-log string proc) 401 (server-log string proc)
402 (let ((prev (process-get proc :previous-string))) 402 (let ((prev (process-get proc :previous-string)))
403 (when prev 403 (when prev
404 (setq string (concat prev string)) 404 (setq string (concat prev string))
405 (process-put proc :previous-string nil))) 405 (process-put proc :previous-string nil)))
406 (when (> (recursion-depth) 0)
407 ;; We're inside a minibuffer already, so if the emacs-client is trying
408 ;; to open a frame on a new display, we might end up with an unusable
409 ;; frame because input from that display will be blocked (until exiting
410 ;; the minibuffer). Better exit this minibuffer right away.
411 ;; Similarly with recursive-edits such as the splash screen.
412 (process-put proc :previous-string string)
413 (run-with-timer 0 nil (lexical-let ((proc proc))
414 (lambda () (server-process-filter proc ""))))
415 (top-level))
406 ;; If the input is multiple lines, 416 ;; If the input is multiple lines,
407 ;; process each line individually. 417 ;; process each line individually.
408 (while (string-match "\n" string) 418 (while (string-match "\n" string)
409 (let ((request (substring string 0 (match-beginning 0))) 419 (let ((request (substring string 0 (match-beginning 0)))
410 (coding-system (and default-enable-multibyte-characters 420 (coding-system (and default-enable-multibyte-characters