Mercurial > emacs
changeset 85946:4a2d5f02a8a7
Johan Bockg? <bojohan at gnu.org>
(eshell-output-filter): Use `with-current-buffer'.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 07 Nov 2007 03:33:56 +0000 |
parents | 8121894d2e35 |
children | 5d3c96e367e5 |
files | lisp/eshell/esh-mode.el |
diffstat | 1 files changed, 30 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/eshell/esh-mode.el Wed Nov 07 00:27:13 2007 +0000 +++ b/lisp/eshell/esh-mode.el Wed Nov 07 03:33:56 2007 +0000 @@ -775,38 +775,36 @@ (setq string (funcall (car functions) string)) (setq functions (cdr functions)))) (if (and string oprocbuf (buffer-name oprocbuf)) - (let ((obuf (current-buffer)) - opoint obeg oend) - (set-buffer oprocbuf) - (setq opoint (point)) - (setq obeg (point-min)) - (setq oend (point-max)) - (let ((buffer-read-only nil) - (nchars (length string)) - (ostart nil)) - (widen) - (goto-char eshell-last-output-end) - (setq ostart (point)) - (if (<= (point) opoint) - (setq opoint (+ opoint nchars))) - (if (< (point) obeg) - (setq obeg (+ obeg nchars))) - (if (<= (point) oend) - (setq oend (+ oend nchars))) - (insert-before-markers string) - (if (= (window-start (selected-window)) (point)) - (set-window-start (selected-window) - (- (point) nchars))) - (if (= (point) eshell-last-input-end) - (set-marker eshell-last-input-end - (- eshell-last-input-end nchars))) - (set-marker eshell-last-output-start ostart) - (set-marker eshell-last-output-end (point)) - (force-mode-line-update)) - (narrow-to-region obeg oend) - (goto-char opoint) - (eshell-run-output-filters) - (set-buffer obuf))))) + (let (opoint obeg oend) + (with-current-buffer oprocbuf + (setq opoint (point)) + (setq obeg (point-min)) + (setq oend (point-max)) + (let ((buffer-read-only nil) + (nchars (length string)) + (ostart nil)) + (widen) + (goto-char eshell-last-output-end) + (setq ostart (point)) + (if (<= (point) opoint) + (setq opoint (+ opoint nchars))) + (if (< (point) obeg) + (setq obeg (+ obeg nchars))) + (if (<= (point) oend) + (setq oend (+ oend nchars))) + (insert-before-markers string) + (if (= (window-start (selected-window)) (point)) + (set-window-start (selected-window) + (- (point) nchars))) + (if (= (point) eshell-last-input-end) + (set-marker eshell-last-input-end + (- eshell-last-input-end nchars))) + (set-marker eshell-last-output-start ostart) + (set-marker eshell-last-output-end (point)) + (force-mode-line-update)) + (narrow-to-region obeg oend) + (goto-char opoint) + (eshell-run-output-filters)))))) (defun eshell-run-output-filters () "Run the `eshell-output-filter-functions' on the current output."