aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-11-07 03:32:41 +0000
committerGlenn Morris2007-11-07 03:32:41 +0000
commit3b32d9a56a6287840a777bd94158fd345d5eee6b (patch)
tree8bc1df790aa470186f39f98b5f051a1ed87c6597
parentcba974dec6edeb6a70e2321f93c3cbcdc8641ff9 (diff)
downloademacs-3b32d9a56a6287840a777bd94158fd345d5eee6b.tar.gz
emacs-3b32d9a56a6287840a777bd94158fd345d5eee6b.zip
Johan Bockg� <bojohan at gnu.org>
(eshell-output-filter): Use `with-current-buffer'.
-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."
775 (setq string (funcall (car functions) string)) 775 (setq string (funcall (car functions) string))
776 (setq functions (cdr functions)))) 776 (setq functions (cdr functions))))
777 (if (and string oprocbuf (buffer-name oprocbuf)) 777 (if (and string oprocbuf (buffer-name oprocbuf))
778 (let ((obuf (current-buffer)) 778 (let (opoint obeg oend)
779 opoint obeg oend) 779 (with-current-buffer oprocbuf
780 (set-buffer oprocbuf) 780 (setq opoint (point))
781 (setq opoint (point)) 781 (setq obeg (point-min))
782 (setq obeg (point-min)) 782 (setq oend (point-max))
783 (setq oend (point-max)) 783 (let ((buffer-read-only nil)
784 (let ((buffer-read-only nil) 784 (nchars (length string))
785 (nchars (length string)) 785 (ostart nil))
786 (ostart nil)) 786 (widen)
787 (widen) 787 (goto-char eshell-last-output-end)
788 (goto-char eshell-last-output-end) 788 (setq ostart (point))
789 (setq ostart (point)) 789 (if (<= (point) opoint)
790 (if (<= (point) opoint) 790 (setq opoint (+ opoint nchars)))
791 (setq opoint (+ opoint nchars))) 791 (if (< (point) obeg)
792 (if (< (point) obeg) 792 (setq obeg (+ obeg nchars)))
793 (setq obeg (+ obeg nchars))) 793 (if (<= (point) oend)
794 (if (<= (point) oend) 794 (setq oend (+ oend nchars)))
795 (setq oend (+ oend nchars))) 795 (insert-before-markers string)
796 (insert-before-markers string) 796 (if (= (window-start (selected-window)) (point))
797 (if (= (window-start (selected-window)) (point)) 797 (set-window-start (selected-window)
798 (set-window-start (selected-window) 798 (- (point) nchars)))
799 (- (point) nchars))) 799 (if (= (point) eshell-last-input-end)
800 (if (= (point) eshell-last-input-end) 800 (set-marker eshell-last-input-end
801 (set-marker eshell-last-input-end 801 (- eshell-last-input-end nchars)))
802 (- eshell-last-input-end nchars))) 802 (set-marker eshell-last-output-start ostart)
803 (set-marker eshell-last-output-start ostart) 803 (set-marker eshell-last-output-end (point))
804 (set-marker eshell-last-output-end (point)) 804 (force-mode-line-update))
805 (force-mode-line-update)) 805 (narrow-to-region obeg oend)
806 (narrow-to-region obeg oend) 806 (goto-char opoint)
807 (goto-char opoint) 807 (eshell-run-output-filters))))))
808 (eshell-run-output-filters)
809 (set-buffer obuf)))))
810 808
811(defun eshell-run-output-filters () 809(defun eshell-run-output-filters ()
812 "Run the `eshell-output-filter-functions' on the current output." 810 "Run the `eshell-output-filter-functions' on the current output."