Function: eshell-interactive-filter

eshell-interactive-filter is a byte-compiled function defined in esh-mode.el.gz.

Signature

(eshell-interactive-filter BUFFER STRING)

Documentation

Send STRING to the interactive display, using BUFFER.

This is done after all necessary filtering has been done.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
(defun eshell-interactive-filter (buffer string)
  "Send STRING to the interactive display, using BUFFER.
This is done after all necessary filtering has been done."
  (unless buffer
    (setq buffer (current-buffer)))
  (when (and string (buffer-live-p buffer))
    (with-current-buffer buffer
      (let ((functions eshell-preoutput-filter-functions))
        (while (and functions string)
          (setq string (funcall (car functions) string))
          (setq functions (cdr functions))))
      (when string
        (let (opoint obeg oend)
          (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)))
            ;; Let the ansi-color overlay hooks run.
            (let ((inhibit-modification-hooks nil))
              (insert string))
            (if (= (window-start) (point))
                (set-window-start (selected-window)
                                  (- (point) 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))))))