aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell/esh-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/eshell/esh-mode.el')
-rw-r--r--lisp/eshell/esh-mode.el75
1 files changed, 38 insertions, 37 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index d0147b345aa..8799007c596 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -690,46 +690,47 @@ newline."
690 "Send the output from PROCESS (STRING) to the interactive display. 690 "Send the output from PROCESS (STRING) to the interactive display.
691This is done after all necessary filtering has been done." 691This is done after all necessary filtering has been done."
692 (let ((oprocbuf (if process (process-buffer process) 692 (let ((oprocbuf (if process (process-buffer process)
693 (current-buffer))) 693 (current-buffer)))
694 (inhibit-point-motion-hooks t) 694 (inhibit-point-motion-hooks t)
695 (inhibit-modification-hooks t)) 695 (inhibit-modification-hooks t))
696 (let ((functions eshell-preoutput-filter-functions)) 696 (when (and string oprocbuf (buffer-name oprocbuf))
697 (while (and functions string) 697 (with-current-buffer oprocbuf
698 (setq string (funcall (car functions) string)) 698 (let ((functions eshell-preoutput-filter-functions))
699 (setq functions (cdr functions)))) 699 (while (and functions string)
700 (if (and string oprocbuf (buffer-name oprocbuf)) 700 (setq string (funcall (car functions) string))
701 (let (opoint obeg oend) 701 (setq functions (cdr functions))))
702 (with-current-buffer oprocbuf 702 (when string
703 (setq opoint (point)) 703 (let (opoint obeg oend)
704 (setq obeg (point-min)) 704 (setq opoint (point))
705 (setq oend (point-max)) 705 (setq obeg (point-min))
706 (let ((buffer-read-only nil) 706 (setq oend (point-max))
707 (nchars (length string)) 707 (let ((buffer-read-only nil)
708 (ostart nil)) 708 (nchars (length string))
709 (widen) 709 (ostart nil))
710 (goto-char eshell-last-output-end) 710 (widen)
711 (setq ostart (point)) 711 (goto-char eshell-last-output-end)
712 (if (<= (point) opoint) 712 (setq ostart (point))
713 (setq opoint (+ opoint nchars))) 713 (if (<= (point) opoint)
714 (if (< (point) obeg) 714 (setq opoint (+ opoint nchars)))
715 (setq obeg (+ obeg nchars))) 715 (if (< (point) obeg)
716 (if (<= (point) oend) 716 (setq obeg (+ obeg nchars)))
717 (setq oend (+ oend nchars))) 717 (if (<= (point) oend)
718 (setq oend (+ oend nchars)))
718 ;; Let the ansi-color overlay hooks run. 719 ;; Let the ansi-color overlay hooks run.
719 (let ((inhibit-modification-hooks nil)) 720 (let ((inhibit-modification-hooks nil))
720 (insert-before-markers string)) 721 (insert-before-markers string))
721 (if (= (window-start) (point)) 722 (if (= (window-start) (point))
722 (set-window-start (selected-window) 723 (set-window-start (selected-window)
723 (- (point) nchars))) 724 (- (point) nchars)))
724 (if (= (point) eshell-last-input-end) 725 (if (= (point) eshell-last-input-end)
725 (set-marker eshell-last-input-end 726 (set-marker eshell-last-input-end
726 (- eshell-last-input-end nchars))) 727 (- eshell-last-input-end nchars)))
727 (set-marker eshell-last-output-start ostart) 728 (set-marker eshell-last-output-start ostart)
728 (set-marker eshell-last-output-end (point)) 729 (set-marker eshell-last-output-end (point))
729 (force-mode-line-update)) 730 (force-mode-line-update))
730 (narrow-to-region obeg oend) 731 (narrow-to-region obeg oend)
731 (goto-char opoint) 732 (goto-char opoint)
732 (eshell-run-output-filters)))))) 733 (eshell-run-output-filters)))))))
733 734
734(defun eshell-run-output-filters () 735(defun eshell-run-output-filters ()
735 "Run the `eshell-output-filter-functions' on the current output." 736 "Run the `eshell-output-filter-functions' on the current output."