From: Steve Haflich

Subject: Re: Emacs interface - how do you get prompt to bottom of frame?

Date: 1999-1-28 23:49

   From: Larry Troxler <westnet.com at lt>
   
   In Inferior Common Lisp mode, i.e. when running an ACL session in
   Xemacs, the Lisp prompt does not end up on the last line of the buffer. 
   Obviously, this is a pretty severe problem, since as much as the bottom
   halft of the frame becomes wasted space. The last time I seriously
   investigated this, I remember finding some sort of re-centering function
   that I was able to bind to a key, to at least manually shift the prompt
   down to the last line of the buffer, after the output was finished. Now
   I can't even figure out that much (the Xemacs docs are pretty poor).

Try setting the elisp variable scroll-step to 1.

 Documentation:
 *The number of lines to try scrolling a window by when point moves out.
 If that fails to bring point back on frame, point is centered instead.
 If this is zero, point is always centered after it moves off frame.

This will cause any inferior subprocess buffer to scroll only a single
line at a time, provided output is not arriving so fast that Emacs
can't keep up, in which case you probably don't care so much.  The
down side of setting this variable is that the first time a
*background-interaction* buffer pops up, it typically will be scrolled
so that _no_ lines of the buffer are visible.  (Theoretically it is
impossible for and Emacs window to be in this state.)  However, ^L or
M-V easily corrects the situation, so I live with it.  It is a bug
either in the emacs-lisp interface or in emacs, but I've never
interested the person responsible for maintaining the interface in the
problem.  (That person used to be me, long ago, and even then I
couldn't interest him...)

You might also find the following simple command helpful.  I bind it
to C-M-l.

(define-key esc-map "\^L" 'smh:cursor-to-top)

(defun smh:cursor-to-top (arg)
  "Move the line with the cursor to the top of the window.
With an argument, move to the end of the buffer and scroll that line
to the end of the visible window."
  (interactive "P")
  (if arg
      (progn (goto-char (point-max))
	     (recenter (- (window-height) 2)))
    (recenter 0)))

Placing the last line line at the bottom is what you asked for.
Placing the cursed line at the top of the screen is really useful if
you want to see as much of a form as will fit in the screen.  Old
people like me need this once short-term memory starts to fade.

This one is also worthy of being on a chorded key.  I use it a lot in
lisp source buffers.  Some day I'll make it aware of prompts in
sublisp buffers so it does the obvious thing there too, but I have a
hidden agenda broadcasting it to the list in hope that someone else
will enhance it for me.

(defun smh:top-of-defun-to-top ()
  "scroll the top of the defun to the top of the window"
  (interactive)
  (let ((pos (point)))
    (mark-defun)
    (if (looking-at "(")
	(forward-line -1))
    (while (and (not (or (looking-at "(")
			 (looking-at "#+")
			 (looking-at "#-")))
		(not (= (point) (point-max))))
      (forward-line 1))
    (recenter 0)
    (if (pos-visible-in-window-p pos)
	(goto-char pos))))

I'm using Gnu emacs, but I suspect these variables and functions also
exists in xemacs.  If not, they undoubtedly have moral equivalents.

   This must be an age-old problem, yet I don't remember seing any answers
   on this list.  Does this mean that nobody uses emacs anymore, or has
   this finally been solved in the ACL/emacs interface code?

I assure you that _real_ lisp programmers use no other.