]> code.delx.au - gnu-emacs/commitdiff
Johan Bockg� <bojohan at gnu.org>
authorGlenn Morris <rgm@gnu.org>
Wed, 7 Nov 2007 03:33:16 +0000 (03:33 +0000)
committerGlenn Morris <rgm@gnu.org>
Wed, 7 Nov 2007 03:33:16 +0000 (03:33 +0000)
(eshell-insertion-filter, eshell-sentinel): Use `with-current-buffer'.

lisp/ChangeLog
lisp/eshell/esh-proc.el

index d39bc8c8ae0f5c1db8245a22aafe78574a9c6edc..ee381421a7d9bc47bb01f47798547101bc7465f4 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-07  Johan Bockg\e,Ae\e(Brd  <bojohan@gnu.org>
+
+       * eshell/esh-mode.el (eshell-output-filter):
+       * eshell/esh-proc.el (eshell-insertion-filter, eshell-sentinel):
+       Use `with-current-buffer'.
+
 2007-11-05  Nick Roberts  <nickrob@snap.net.nz>
 
        * progmodes/gud.el (gud-gdb): Remove vestigial gdba doc and code.
index fb226cf51fbababd5d1f75289511cc0d063afabe..7338756e3f82048003c1ec6f65f820d11cf2543f 100644 (file)
@@ -335,39 +335,39 @@ Used only on systems which do not support async subprocesses.")
 PROC is the process for which we're inserting output.  STRING is the
 output."
   (when (buffer-live-p (process-buffer proc))
-    (set-buffer (process-buffer proc))
-    (let ((entry (assq proc eshell-process-list)))
-      (when entry
-       (setcar (nthcdr 3 entry)
-               (concat (nth 3 entry) string))
-       (unless (nth 4 entry)           ; already being handled?
-         (while (nth 3 entry)
-           (let ((data (nth 3 entry)))
-             (setcar (nthcdr 3 entry) nil)
-             (setcar (nthcdr 4 entry) t)
-             (eshell-output-object data nil (cadr entry))
-             (setcar (nthcdr 4 entry) nil))))))))
+    (with-current-buffer (process-buffer proc)
+      (let ((entry (assq proc eshell-process-list)))
+       (when entry
+         (setcar (nthcdr 3 entry)
+                 (concat (nth 3 entry) string))
+         (unless (nth 4 entry)         ; already being handled?
+           (while (nth 3 entry)
+             (let ((data (nth 3 entry)))
+               (setcar (nthcdr 3 entry) nil)
+               (setcar (nthcdr 4 entry) t)
+               (eshell-output-object data nil (cadr entry))
+               (setcar (nthcdr 4 entry) nil)))))))))
 
 (defun eshell-sentinel (proc string)
   "Generic sentinel for command processes.  Reports only signals.
 PROC is the process that's exiting.  STRING is the exit message."
   (when (buffer-live-p (process-buffer proc))
-    (set-buffer (process-buffer proc))
-    (unwind-protect
-       (let* ((entry (assq proc eshell-process-list)))
-;        (if (not entry)
-;            (error "Sentinel called for unowned process `%s'"
-;                   (process-name proc))
-         (when entry
-           (unwind-protect
-               (progn
-                 (unless (string= string "run")
-                   (unless (string-match "^\\(finished\\|exited\\)" string)
-                     (eshell-insertion-filter proc string))
-                   (eshell-close-handles (process-exit-status proc) 'nil
-                                         (cadr entry))))
-             (eshell-remove-process-entry entry))))
-      (run-hook-with-args 'eshell-kill-hook proc string))))
+    (with-current-buffer (process-buffer proc)
+      (unwind-protect
+         (let* ((entry (assq proc eshell-process-list)))
+;          (if (not entry)
+;              (error "Sentinel called for unowned process `%s'"
+;                     (process-name proc))
+           (when entry
+             (unwind-protect
+                 (progn
+                   (unless (string= string "run")
+                     (unless (string-match "^\\(finished\\|exited\\)" string)
+                       (eshell-insertion-filter proc string))
+                     (eshell-close-handles (process-exit-status proc) 'nil
+                                           (cadr entry))))
+               (eshell-remove-process-entry entry))))
+       (run-hook-with-args 'eshell-kill-hook proc string)))))
 
 (defun eshell-process-interact (func &optional all query)
   "Interact with a process, using PROMPT if more than one, via FUNC.