kgk@cs.brown.edu (Keiji Kanazawa) (11/19/90)
The standard behavior of GNU emacs using the supplied shell mode is that when the cursor is not in a shell buffer, the shell output does not scroll past the bottom of the visible portion of the buffer. Is there some switch to make a visible shell buffer scroll, even if the cursor is not in the shell buffer? If not, does anybody have a simple way to accomplish this, by process sentinels or something? I'm not interested in another shell mode unless it is completely plug compatible with the distributed version. Thanks. -- Keiji Kanazawa kgk@cs.brown.edu
ange@hplb.hpl.hp.com (Andy Norman) (11/20/90)
>>>>> "Keiji" == kgk@cs.brown.edu (Keiji Kanazawa) writes:
Keiji> The standard behavior of GNU emacs using the supplied shell mode is
Keiji> that when the cursor is not in a shell buffer, the shell output does
Keiji> not scroll past the bottom of the visible portion of the buffer. Is
Keiji> there some switch to make a visible shell buffer scroll, even if the
Keiji> cursor is not in the shell buffer?
No, but the patch below might do what you want.
-- ange --
ange@hplb.hpl.hp.com
(setq shell-mode-hook 'bolt-on-filter)
(defun bolt-on-filter ()
"Add a process filter to the process attached to the current buffer."
(let ((proc (get-buffer-process (current-buffer))))
(if proc
(set-process-filter proc 'generic-pop-up-filter))))
(defun generic-pop-up-filter (proc str)
"Handle all output from the process. If the process buffer is visible,
try to keep the end on screen."
(let* ((buf (process-buffer proc))
(win (get-buffer-window buf)))
(if win
(let ((cur (selected-window)))
(unwind-protect
(let (moving)
(select-window win)
(setq moving (= (point) (process-mark proc)))
(save-excursion
(goto-char (process-mark proc))
(insert str)
(set-marker (process-mark proc) (point)))
(if moving (goto-char (process-mark proc))))
(select-window cur)))
(save-excursion
(set-buffer buf)
(goto-char (process-mark proc))
(insert str)
(set-marker (process-mark proc) (point))))))