summaryrefslogtreecommitdiff
path: root/lisp/eshell/esh-mode.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-11-07 03:32:41 +0000
committerGlenn Morris <rgm@gnu.org>2007-11-07 03:32:41 +0000
commit3b32d9a56a6287840a777bd94158fd345d5eee6b (patch)
tree8bc1df790aa470186f39f98b5f051a1ed87c6597 /lisp/eshell/esh-mode.el
parentcba974dec6edeb6a70e2321f93c3cbcdc8641ff9 (diff)
downloademacs-3b32d9a56a6287840a777bd94158fd345d5eee6b.tar.gz
Johan Bockg� <bojohan at gnu.org>
(eshell-output-filter): Use `with-current-buffer'.
Diffstat (limited to 'lisp/eshell/esh-mode.el')
-rw-r--r--lisp/eshell/esh-mode.el62
1 files changed, 30 insertions, 32 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index fd3cfb93996..203bab86924 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -775,38 +775,36 @@ This is done after all necessary filtering has been done."
(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."