aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-11-07 03:33:16 +0000
committerGlenn Morris2007-11-07 03:33:16 +0000
commit1b3f94df29c903411b6550fdd5a4f73a3e48943c (patch)
treea92e0f0e46e826e9602784b05da7dd7da8d54147
parent3b32d9a56a6287840a777bd94158fd345d5eee6b (diff)
downloademacs-1b3f94df29c903411b6550fdd5a4f73a3e48943c.tar.gz
emacs-1b3f94df29c903411b6550fdd5a4f73a3e48943c.zip
Johan Bockg� <bojohan at gnu.org>
(eshell-insertion-filter, eshell-sentinel): Use `with-current-buffer'.
-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 d39bc8c8ae0..ee381421a7d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12007-11-07 Johan Bockg,Ae(Brd <bojohan@gnu.org>
2
3 * eshell/esh-mode.el (eshell-output-filter):
4 * eshell/esh-proc.el (eshell-insertion-filter, eshell-sentinel):
5 Use `with-current-buffer'.
6
12007-11-05 Nick Roberts <nickrob@snap.net.nz> 72007-11-05 Nick Roberts <nickrob@snap.net.nz>
2 8
3 * progmodes/gud.el (gud-gdb): Remove vestigial gdba doc and code. 9 * progmodes/gud.el (gud-gdb): Remove vestigial gdba doc and code.
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.")
335PROC is the process for which we're inserting output. STRING is the 335PROC is the process for which we're inserting output. STRING is the
336output." 336output."
337 (when (buffer-live-p (process-buffer proc)) 337 (when (buffer-live-p (process-buffer proc))
338 (set-buffer (process-buffer proc)) 338 (with-current-buffer (process-buffer proc)
339 (let ((entry (assq proc eshell-process-list))) 339 (let ((entry (assq proc eshell-process-list)))
340 (when entry 340 (when entry
341 (setcar (nthcdr 3 entry) 341 (setcar (nthcdr 3 entry)
342 (concat (nth 3 entry) string)) 342 (concat (nth 3 entry) string))
343 (unless (nth 4 entry) ; already being handled? 343 (unless (nth 4 entry) ; already being handled?
344 (while (nth 3 entry) 344 (while (nth 3 entry)
345 (let ((data (nth 3 entry))) 345 (let ((data (nth 3 entry)))
346 (setcar (nthcdr 3 entry) nil) 346 (setcar (nthcdr 3 entry) nil)
347 (setcar (nthcdr 4 entry) t) 347 (setcar (nthcdr 4 entry) t)
348 (eshell-output-object data nil (cadr entry)) 348 (eshell-output-object data nil (cadr entry))
349 (setcar (nthcdr 4 entry) nil)))))))) 349 (setcar (nthcdr 4 entry) nil)))))))))
350 350
351(defun eshell-sentinel (proc string) 351(defun eshell-sentinel (proc string)
352 "Generic sentinel for command processes. Reports only signals. 352 "Generic sentinel for command processes. Reports only signals.
353PROC is the process that's exiting. STRING is the exit message." 353PROC is the process that's exiting. STRING is the exit message."
354 (when (buffer-live-p (process-buffer proc)) 354 (when (buffer-live-p (process-buffer proc))
355 (set-buffer (process-buffer proc)) 355 (with-current-buffer (process-buffer proc)
356 (unwind-protect 356 (unwind-protect
357 (let* ((entry (assq proc eshell-process-list))) 357 (let* ((entry (assq proc eshell-process-list)))
358; (if (not entry) 358; (if (not entry)
359; (error "Sentinel called for unowned process `%s'" 359; (error "Sentinel called for unowned process `%s'"
360; (process-name proc)) 360; (process-name proc))
361 (when entry 361 (when entry
362 (unwind-protect 362 (unwind-protect
363 (progn 363 (progn
364 (unless (string= string "run") 364 (unless (string= string "run")
365 (unless (string-match "^\\(finished\\|exited\\)" string) 365 (unless (string-match "^\\(finished\\|exited\\)" string)
366 (eshell-insertion-filter proc string)) 366 (eshell-insertion-filter proc string))
367 (eshell-close-handles (process-exit-status proc) 'nil 367 (eshell-close-handles (process-exit-status proc) 'nil
368 (cadr entry)))) 368 (cadr entry))))
369 (eshell-remove-process-entry entry)))) 369 (eshell-remove-process-entry entry))))
370 (run-hook-with-args 'eshell-kill-hook proc string)))) 370 (run-hook-with-args 'eshell-kill-hook proc string)))))
371 371
372(defun eshell-process-interact (func &optional all query) 372(defun eshell-process-interact (func &optional all query)
373 "Interact with a process, using PROMPT if more than one, via FUNC. 373 "Interact with a process, using PROMPT if more than one, via FUNC.