summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-11-07 03:34:45 +0000
committerGlenn Morris <rgm@gnu.org>2007-11-07 03:34:45 +0000
commitdafac6f36e195e6ce263f12018243a13e84c4616 (patch)
treea3df61aee5f9025e3fb00dec98a4b63c67db7fb6 /lisp
parentd3204296edbaa8e4d6eb8b4a87ba6c75a2a11ffd (diff)
downloademacs-dafac6f36e195e6ce263f12018243a13e84c4616.tar.gz
emacs-dafac6f36e195e6ce263f12018243a13e84c4616.tar.bz2
emacs-dafac6f36e195e6ce263f12018243a13e84c4616.zip
Johan Bockg� <bojohan at gnu.org>
(eshell-insertion-filter, eshell-sentinel): Use `with-current-buffer'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/eshell/esh-proc.el56
2 files changed, 34 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b875a486cd..49a01790684 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-07 Johan Bockg,Ae(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-07 Andreas Schwab <schwab@suse.de>
* server.el (server-start): Only register cleanup after server was
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index fb226cf51fb..7338756e3f8 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -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.