Mercurial > emacs
comparison lisp/server.el @ 49686:64195811ff44
(server-previous-strings): Remove.
(server-process-filter): Use (process-get 'previous-string) instead.
(server-sentinel): Remove code made superfluous.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 10 Feb 2003 21:44:24 +0000 |
parents | cc4646701e99 |
children | 1b32397dd4e2 d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
49685:c205b3bd7372 | 49686:64195811ff44 |
---|---|
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 | |
103 (defvar server-previous-strings nil) | |
104 | 102 |
105 (defvar server-clients nil | 103 (defvar server-clients nil |
106 "List of current server clients. | 104 "List of current server clients. |
107 Each element is (CLIENTID BUFFERS...) where CLIENTID is a string | 105 Each element is (CLIENTID BUFFERS...) where CLIENTID is a string |
108 that can be given to the server process to identify a client. | 106 that can be given to the server process to identify a client. |
177 (if client (format " %s:" client) " ") | 175 (if client (format " %s:" client) " ") |
178 string) | 176 string) |
179 (or (bolp) (newline))))) | 177 (or (bolp) (newline))))) |
180 | 178 |
181 (defun server-sentinel (proc msg) | 179 (defun server-sentinel (proc msg) |
182 ;; Purge server-previous-strings of the now irrelevant entry. | |
183 (setq server-previous-strings | |
184 (delq (assq proc server-previous-strings) server-previous-strings)) | |
185 (let ((client (assq proc server-clients))) | 180 (let ((client (assq proc server-clients))) |
186 ;; Remove PROC from the list of clients. | 181 ;; Remove PROC from the list of clients. |
187 (when client | 182 (when client |
188 (setq server-clients (delq client server-clients)) | 183 (setq server-clients (delq client server-clients)) |
189 (dolist (buf (cdr client)) | 184 (dolist (buf (cdr client)) |
280 | 275 |
281 (defun server-process-filter (proc string) | 276 (defun server-process-filter (proc string) |
282 "Process a request from the server to edit some files. | 277 "Process a request from the server to edit some files. |
283 PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"." | 278 PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"." |
284 (server-log string proc) | 279 (server-log string proc) |
285 (let ((ps (assq proc server-previous-strings))) | 280 (let ((prev (process-get proc 'previous-string))) |
286 (when (cdr ps) | 281 (when prev |
287 (setq string (concat (cdr ps) string)) | 282 (setq string (concat prev string)) |
288 (setcdr ps nil))) | 283 (process-put proc 'previous-string nil))) |
289 ;; If the input is multiple lines, | 284 ;; If the input is multiple lines, |
290 ;; process each line individually. | 285 ;; process each line individually. |
291 (while (string-match "\n" string) | 286 (while (string-match "\n" string) |
292 (let ((request (substring string 0 (match-beginning 0))) | 287 (let ((request (substring string 0 (match-beginning 0))) |
293 (coding-system (and default-enable-multibyte-characters | 288 (coding-system (and default-enable-multibyte-characters |
360 (unless nowait | 355 (unless nowait |
361 (message (substitute-command-keys | 356 (message (substitute-command-keys |
362 "When done with a buffer, type \\[server-edit]"))))))) | 357 "When done with a buffer, type \\[server-edit]"))))))) |
363 ;; Save for later any partial line that remains. | 358 ;; Save for later any partial line that remains. |
364 (when (> (length string) 0) | 359 (when (> (length string) 0) |
365 (let ((ps (assq proc server-previous-strings))) | 360 (process-put proc 'previous-string string))) |
366 (if ps (setcdr ps string) | |
367 (push (cons proc string) server-previous-strings))))) | |
368 | 361 |
369 (defun server-goto-line-column (file-line-col) | 362 (defun server-goto-line-column (file-line-col) |
370 (goto-line (nth 1 file-line-col)) | 363 (goto-line (nth 1 file-line-col)) |
371 (let ((column-number (nth 2 file-line-col))) | 364 (let ((column-number (nth 2 file-line-col))) |
372 (if (> column-number 0) | 365 (if (> column-number 0) |