diff options
| author | Glenn Morris | 2007-11-07 03:33:56 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-11-07 03:33:56 +0000 |
| commit | d3204296edbaa8e4d6eb8b4a87ba6c75a2a11ffd (patch) | |
| tree | 9e7646404fe449e5d9886549eca7618f9d8bb137 /lisp/eshell | |
| parent | 1d515b422c71737385f6d037ace407962edb67a3 (diff) | |
| download | emacs-d3204296edbaa8e4d6eb8b4a87ba6c75a2a11ffd.tar.gz emacs-d3204296edbaa8e4d6eb8b4a87ba6c75a2a11ffd.zip | |
Johan Bockg� <bojohan at gnu.org>
(eshell-output-filter): Use `with-current-buffer'.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/esh-mode.el | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index b8f88981b04..1ac74f3f52d 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." |