diff options
| author | Glenn Morris | 2007-11-07 03:34:45 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-11-07 03:34:45 +0000 |
| commit | dafac6f36e195e6ce263f12018243a13e84c4616 (patch) | |
| tree | a3df61aee5f9025e3fb00dec98a4b63c67db7fb6 | |
| parent | d3204296edbaa8e4d6eb8b4a87ba6c75a2a11ffd (diff) | |
| download | emacs-dafac6f36e195e6ce263f12018243a13e84c4616.tar.gz emacs-dafac6f36e195e6ce263f12018243a13e84c4616.zip | |
Johan Bockg� <bojohan at gnu.org>
(eshell-insertion-filter, eshell-sentinel): Use `with-current-buffer'.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 56 |
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 @@ | |||
| 1 | 2007-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 | |||
| 1 | 2007-11-07 Andreas Schwab <schwab@suse.de> | 7 | 2007-11-07 Andreas Schwab <schwab@suse.de> |
| 2 | 8 | ||
| 3 | * server.el (server-start): Only register cleanup after server was | 9 | * 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.") | |||
| 335 | PROC is the process for which we're inserting output. STRING is the | 335 | PROC is the process for which we're inserting output. STRING is the |
| 336 | output." | 336 | output." |
| 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. |
| 353 | PROC is the process that's exiting. STRING is the exit message." | 353 | PROC 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. |