Article View: gnu.emacs.help
Article #189091Re: Shell mode behaviour
From: Gabriel
Date: Mon, 29 Apr 1991 19:49
Date: Mon, 29 Apr 1991 19:49
44 lines
2188 bytes
2188 bytes
If running a subshell the output of a shell command is often displayed
with the last line in the middle of the Emacs window. I'd rather like
Emacs to put the shell prompt always at the bottom of the window.
This requires writing an elisp filter function for the shell process.
(I think you also have to set `scroll-step' to 2 or some value that will
work.) Here's the code I wrote up some time ago:
(defun my-shell-filter (process string)
(let* ((buffer (process-buffer process))
(marker (process-mark process))
(window (get-buffer-window buffer))
(current-window (selected-window)))
(save-excursion
(set-buffer buffer)
(goto-char marker)
(insert string)
(set-marker marker (point)))
(if window
(unwind-protect
(progn
(select-window window)
(goto-char marker)
(recenter (- (window-height) 2))
(end-of-line))
(select-window current-window)))))
(defun my-shell ()
(interactive)
(shell)
(set-process-filter (get-process "shell") 'my-shell-filter))
Just start up the shell with M-x my-shell. You may also, as I said,
have to M-x set-variable scroll-step.
--
Raul Acevedo
acevedo@athena.mit.edu
"Remember, Information is not knowledge; Knowledge is not Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love;
Love is not music; Music is the best."
- Frank Zappa
Technical Details
Message-ID:
<ACEVEDO.91Apr29154901@boom.mit.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!mintaka!bloom-picayune.mit.edu!athena.mit.edu!acevedoReferences:
<9104291037.AA23185@life.ai.mit.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,4ba508e285137e41,start X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-05-01 21:56:17 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!mintaka!bloom-picayune.mit.edu!athena.mit.edu!acevedo From: acevedo@athena.mit.edu (Gabriel) Newsgroups: gnu.emacs.help Subject: Re: Shell mode behaviour Message-ID: <ACEVEDO.91Apr29154901@boom.mit.edu> Date: 29 Apr 91 19:49:07 GMT References: <9104291037.AA23185@life.ai.mit.edu> Sender: news@athena.mit.edu (News system) Followup-To: gnu.emacs.help Organization: Massachusetts Institute of Technology Lines: 44 In-Reply-To: L58%DHDURZ1.BITNET@MITVMA.MIT.EDU's message of 29 Apr 91 17:26:18 GMT