Function: eshell-preinput-scroll-to-bottom

eshell-preinput-scroll-to-bottom is a byte-compiled function defined in esh-mode.el.gz.

Signature

(eshell-preinput-scroll-to-bottom)

Documentation

Go to the end of buffer in all windows showing it.

Movement occurs if point in the selected window is not after the process mark, and this-command is an insertion command. Insertion commands recognized are self-insert-command, yank, and hilit-yank. Depends on the value of eshell-scroll-to-bottom-on-input.

This function should be a pre-command hook.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
;;; jww (1999-10-23): this needs testing
(defun eshell-preinput-scroll-to-bottom ()
  "Go to the end of buffer in all windows showing it.
Movement occurs if point in the selected window is not after the
process mark, and `this-command' is an insertion command.  Insertion
commands recognized are `self-insert-command', `yank', and
`hilit-yank'.  Depends on the value of
`eshell-scroll-to-bottom-on-input'.

This function should be a pre-command hook."
  (if (memq this-command '(self-insert-command yank hilit-yank))
      (let* ((selected (selected-window))
	     (current (current-buffer))
	     (scroll eshell-scroll-to-bottom-on-input))
	(if (< (point) eshell-last-output-end)
	    (if (eq scroll 'this)
		(goto-char (point-max))
	      (walk-windows
               (lambda (window)
                 (when (and (eq (window-buffer window) current)
                            (or (eq scroll t) (eq scroll 'all)))
                   (select-window window)
                   (goto-char (point-max))
                   (select-window selected)))
	       nil t))))))