diff options
| author | Juanma Barranquero | 2008-11-18 16:27:06 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2008-11-18 16:27:06 +0000 |
| commit | a77ad24064fe681a502c893b38ea0a986018963c (patch) | |
| tree | f34e6b75de5fa9fd04d50ad85f8d29abc7261e93 | |
| parent | 1ba1f458d8fe1ef67b32dc3ce414d9d36fa0dff1 (diff) | |
| download | emacs-a77ad24064fe681a502c893b38ea0a986018963c.tar.gz emacs-a77ad24064fe681a502c893b38ea0a986018963c.zip | |
* server.el (server-temp-file-p): Use `string-match-p'.
(server-socket-dir): Set to nil if local sockets are unsupported.
(server-start): Don't try to delete local socket if unsupported.
(server-kill-new-buffers): Reflow docstring.
(server-delete-client, server-handle-delete-frame)
(server-save-buffers-kill-terminal): Doc fixes.
(server-send-string): Fix typo in docstring.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/server.el | 33 |
2 files changed, 28 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0fca95bea2d..8f871362adb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2008-11-18 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * server.el (server-temp-file-p): Use `string-match-p'. | ||
| 4 | (server-socket-dir): Set to nil if local sockets are unsupported. | ||
| 5 | (server-start): Don't try to delete local socket if unsupported. | ||
| 6 | (server-kill-new-buffers): Reflow docstring. | ||
| 7 | (server-delete-client, server-handle-delete-frame) | ||
| 8 | (server-save-buffers-kill-terminal): Doc fixes. | ||
| 9 | (server-send-string): Fix typo in docstring. | ||
| 10 | |||
| 1 | 2008-11-18 Sam Steingold <sds@gnu.org> | 11 | 2008-11-18 Sam Steingold <sds@gnu.org> |
| 2 | 12 | ||
| 3 | * progmodes/compile.el (compilation-start-hook): New hook. | 13 | * progmodes/compile.el (compilation-start-hook): New hook. |
diff --git a/lisp/server.el b/lisp/server.el index 84e03f30391..d488fb1f4ca 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -185,8 +185,8 @@ If non-nil, kill a buffer unless it already existed before editing | |||
| 185 | it with the Emacs server. If nil, kill only buffers as specified by | 185 | it with the Emacs server. If nil, kill only buffers as specified by |
| 186 | `server-temp-file-regexp'. | 186 | `server-temp-file-regexp'. |
| 187 | Please note that only buffers that still have a client are killed, | 187 | Please note that only buffers that still have a client are killed, |
| 188 | i.e. buffers visited with \"emacsclient --no-wait\" are never killed in | 188 | i.e. buffers visited with \"emacsclient --no-wait\" are never killed |
| 189 | this way." | 189 | in this way." |
| 190 | :group 'server | 190 | :group 'server |
| 191 | :type 'boolean | 191 | :type 'boolean |
| 192 | :version "21.1") | 192 | :version "21.1") |
| @@ -203,8 +203,10 @@ are done with it in the server.") | |||
| 203 | (defvar server-name "server") | 203 | (defvar server-name "server") |
| 204 | 204 | ||
| 205 | (defvar server-socket-dir | 205 | (defvar server-socket-dir |
| 206 | (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)) | 206 | (and (featurep 'make-network-process '(:family local)) |
| 207 | "The directory in which to place the server socket.") | 207 | (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))) |
| 208 | "The directory in which to place the server socket. | ||
| 209 | If local sockets are not supported, this is nil.") | ||
| 208 | 210 | ||
| 209 | (defun server-clients-with (property value) | 211 | (defun server-clients-with (property value) |
| 210 | "Return a list of clients with PROPERTY set to VALUE." | 212 | "Return a list of clients with PROPERTY set to VALUE." |
| @@ -238,8 +240,8 @@ ENV should be in the same format as `process-environment'." | |||
| 238 | 240 | ||
| 239 | (defun server-delete-client (proc &optional noframe) | 241 | (defun server-delete-client (proc &optional noframe) |
| 240 | "Delete PROC, including its buffers, terminals and frames. | 242 | "Delete PROC, including its buffers, terminals and frames. |
| 241 | If NOFRAME is non-nil, let the frames live. (To be used from | 243 | If NOFRAME is non-nil, let the frames live. |
| 242 | `delete-frame-functions'.)" | 244 | Updates `server-clients'." |
| 243 | (server-log (concat "server-delete-client" (if noframe " noframe")) proc) | 245 | (server-log (concat "server-delete-client" (if noframe " noframe")) proc) |
| 244 | ;; Force a new lookup of client (prevents infinite recursion). | 246 | ;; Force a new lookup of client (prevents infinite recursion). |
| 245 | (when (memq proc server-clients) | 247 | (when (memq proc server-clients) |
| @@ -333,7 +335,7 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 333 | 335 | ||
| 334 | (defun server-select-display (display) | 336 | (defun server-select-display (display) |
| 335 | ;; If the current frame is on `display' we're all set. | 337 | ;; If the current frame is on `display' we're all set. |
| 336 | ;; Similarly if we are unable to open a frames on other displays, there's | 338 | ;; Similarly if we are unable to open frames on other displays, there's |
| 337 | ;; nothing more we can do. | 339 | ;; nothing more we can do. |
| 338 | (unless (or (not (fboundp 'make-frame-on-display)) | 340 | (unless (or (not (fboundp 'make-frame-on-display)) |
| 339 | (equal (frame-parameter (selected-frame) 'display) display)) | 341 | (equal (frame-parameter (selected-frame) 'display) display)) |
| @@ -375,7 +377,8 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 375 | (set-frame-parameter frame 'server-dummy-buffer nil))) | 377 | (set-frame-parameter frame 'server-dummy-buffer nil))) |
| 376 | 378 | ||
| 377 | (defun server-handle-delete-frame (frame) | 379 | (defun server-handle-delete-frame (frame) |
| 378 | "Delete the client connection when the emacsclient frame is deleted." | 380 | "Delete the client connection when the emacsclient frame is deleted. |
| 381 | \(To be used from `delete-frame-functions'.)" | ||
| 379 | (let ((proc (frame-parameter frame 'client))) | 382 | (let ((proc (frame-parameter frame 'client))) |
| 380 | (when (and (frame-live-p frame) | 383 | (when (and (frame-live-p frame) |
| 381 | proc | 384 | proc |
| @@ -425,7 +428,7 @@ See `server-unquote-arg' and `server-process-filter'." | |||
| 425 | arg t t)) | 428 | arg t t)) |
| 426 | 429 | ||
| 427 | (defun server-send-string (proc string) | 430 | (defun server-send-string (proc string) |
| 428 | "A wrapper around `proc-send-string' for logging." | 431 | "A wrapper around `process-send-string' for logging." |
| 429 | (server-log (concat "Sent " string) proc) | 432 | (server-log (concat "Sent " string) proc) |
| 430 | (process-send-string proc string)) | 433 | (process-send-string proc string)) |
| 431 | 434 | ||
| @@ -465,9 +468,10 @@ kill any existing server communications subprocess." | |||
| 465 | ;; kill it dead! | 468 | ;; kill it dead! |
| 466 | (ignore-errors (delete-process server-process))) | 469 | (ignore-errors (delete-process server-process))) |
| 467 | ;; Delete the socket files made by previous server invocations. | 470 | ;; Delete the socket files made by previous server invocations. |
| 468 | (condition-case () | 471 | (when server-socket-dir |
| 469 | (delete-file (expand-file-name server-name server-socket-dir)) | 472 | (condition-case () |
| 470 | (error nil)) | 473 | (delete-file (expand-file-name server-name server-socket-dir)) |
| 474 | (error nil))) | ||
| 471 | ;; If this Emacs already had a server, clear out associated status. | 475 | ;; If this Emacs already had a server, clear out associated status. |
| 472 | (while server-clients | 476 | (while server-clients |
| 473 | (server-delete-client (car server-clients))) | 477 | (server-delete-client (car server-clients))) |
| @@ -645,7 +649,6 @@ Server mode runs a process that accepts commands from the | |||
| 645 | (switch-to-buffer (get-buffer-create "*scratch*") 'norecord) | 649 | (switch-to-buffer (get-buffer-create "*scratch*") 'norecord) |
| 646 | frame))) | 650 | frame))) |
| 647 | 651 | ||
| 648 | |||
| 649 | (defun server-goto-toplevel (proc) | 652 | (defun server-goto-toplevel (proc) |
| 650 | (condition-case nil | 653 | (condition-case nil |
| 651 | ;; If we're running isearch, we must abort it to allow Emacs to | 654 | ;; If we're running isearch, we must abort it to allow Emacs to |
| @@ -1144,7 +1147,7 @@ reused to pass information to another program. | |||
| 1144 | The variable `server-temp-file-regexp' controls which filenames | 1147 | The variable `server-temp-file-regexp' controls which filenames |
| 1145 | are considered temporary." | 1148 | are considered temporary." |
| 1146 | (and (buffer-file-name buffer) | 1149 | (and (buffer-file-name buffer) |
| 1147 | (string-match server-temp-file-regexp (buffer-file-name buffer)))) | 1150 | (string-match-p server-temp-file-regexp (buffer-file-name buffer)))) |
| 1148 | 1151 | ||
| 1149 | (defun server-done () | 1152 | (defun server-done () |
| 1150 | "Offer to save current buffer, mark it as \"done\" for clients. | 1153 | "Offer to save current buffer, mark it as \"done\" for clients. |
| @@ -1303,7 +1306,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)." | |||
| 1303 | ;; Called from save-buffers-kill-terminal in files.el. | 1306 | ;; Called from save-buffers-kill-terminal in files.el. |
| 1304 | "Offer to save each buffer, then kill PROC. | 1307 | "Offer to save each buffer, then kill PROC. |
| 1305 | 1308 | ||
| 1306 | With prefix arg, silently save all file-visiting buffers, then kill. | 1309 | With ARG non-nil, silently save all file-visiting buffers, then kill. |
| 1307 | 1310 | ||
| 1308 | If emacsclient was started with a list of filenames to edit, then | 1311 | If emacsclient was started with a list of filenames to edit, then |
| 1309 | only these files will be asked to be saved." | 1312 | only these files will be asked to be saved." |