diff options
| author | David Reitter | 2010-08-26 09:46:19 -0400 |
|---|---|---|
| committer | David Reitter | 2010-08-26 09:46:19 -0400 |
| commit | 38dbc4d81a2c4a707b04f2cae8bf9272763f34fb (patch) | |
| tree | 6e2dbda8c9b6d8372824cf876f0a892ad7781ae3 | |
| parent | f0b44bc03a4a831ce05bb8f661637438a08e1654 (diff) | |
| download | emacs-38dbc4d81a2c4a707b04f2cae8bf9272763f34fb.tar.gz emacs-38dbc4d81a2c4a707b04f2cae8bf9272763f34fb.zip | |
server.el (server-visit-files): Run pre-command-hook and
post-command-hook for each buffer while it is current
(Bug#6910).
(server-execute): Do not run hooks here.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/server.el | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb2ea814c14..78e5c32beb0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-08-26 David Reitter <david.reitter@gmail.com> | ||
| 2 | |||
| 3 | * server.el (server-visit-files): Run pre-command-hook and | ||
| 4 | post-command-hook for each buffer while it is current | ||
| 5 | (Bug#6910). | ||
| 6 | (server-execute): Do not run hooks here. | ||
| 7 | |||
| 1 | 2010-08-26 Michael Albinus <michael.albinus@gmx.de> | 8 | 2010-08-26 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 9 | ||
| 3 | Sync with Tramp 2.1.19. | 10 | Sync with Tramp 2.1.19. |
diff --git a/lisp/server.el b/lisp/server.el index b2cb829adf7..f0e88d03612 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1093,9 +1093,7 @@ The following commands are accepted by the client: | |||
| 1093 | (condition-case err | 1093 | (condition-case err |
| 1094 | (let* ((buffers | 1094 | (let* ((buffers |
| 1095 | (when files | 1095 | (when files |
| 1096 | (run-hooks 'pre-command-hook) | 1096 | (server-visit-files files proc nowait)))) |
| 1097 | (prog1 (server-visit-files files proc nowait) | ||
| 1098 | (run-hooks 'post-command-hook))))) | ||
| 1099 | 1097 | ||
| 1100 | (mapc 'funcall (nreverse commands)) | 1098 | (mapc 'funcall (nreverse commands)) |
| 1101 | 1099 | ||
| @@ -1166,8 +1164,13 @@ so don't mark these buffers specially, just visit them normally." | |||
| 1166 | (obuf (get-file-buffer filen))) | 1164 | (obuf (get-file-buffer filen))) |
| 1167 | (add-to-history 'file-name-history filen) | 1165 | (add-to-history 'file-name-history filen) |
| 1168 | (if (null obuf) | 1166 | (if (null obuf) |
| 1169 | (set-buffer (find-file-noselect filen)) | 1167 | (progn |
| 1168 | (run-hooks 'pre-command-hook) | ||
| 1169 | (set-buffer (find-file-noselect filen))) | ||
| 1170 | (set-buffer obuf) | 1170 | (set-buffer obuf) |
| 1171 | ;; separately for each file, in sync with post-command hooks, | ||
| 1172 | ;; with the new buffer current: | ||
| 1173 | (run-hooks 'pre-command-hook) | ||
| 1171 | (cond ((file-exists-p filen) | 1174 | (cond ((file-exists-p filen) |
| 1172 | (when (not (verify-visited-file-modtime obuf)) | 1175 | (when (not (verify-visited-file-modtime obuf)) |
| 1173 | (revert-buffer t nil))) | 1176 | (revert-buffer t nil))) |
| @@ -1179,7 +1182,9 @@ so don't mark these buffers specially, just visit them normally." | |||
| 1179 | (unless server-buffer-clients | 1182 | (unless server-buffer-clients |
| 1180 | (setq server-existing-buffer t))) | 1183 | (setq server-existing-buffer t))) |
| 1181 | (server-goto-line-column (cdr file)) | 1184 | (server-goto-line-column (cdr file)) |
| 1182 | (run-hooks 'server-visit-hook)) | 1185 | (run-hooks 'server-visit-hook) |
| 1186 | ;; hooks may be specific to current buffer: | ||
| 1187 | (run-hooks 'post-command-hook)) | ||
| 1183 | (unless nowait | 1188 | (unless nowait |
| 1184 | ;; When the buffer is killed, inform the clients. | 1189 | ;; When the buffer is killed, inform the clients. |
| 1185 | (add-hook 'kill-buffer-hook 'server-kill-buffer nil t) | 1190 | (add-hook 'kill-buffer-hook 'server-kill-buffer nil t) |