[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

window scrolling

      Date: Thu, 29 Nov 90 18:01:49 est
      From: "Roland Zito-wolf" <rjz@chaos.cs.brandeis.edu>

      Question: i am doing output simultaneously to several windows and
      i want them all to continually update as text arrives, just as the listener does
      (but they're not listeners, they're fred-windows).
      Is there a function I can call that will reposition the display-mark
      so that the last line of the bufer is displayed in the last line of the

   See the description of window-start-mark, on page 289 of the 1.3
   manual.  You'll also have to force a redisplay once you've changed
   the position of the mark.

and From: jona@aristotle.ils.nwu.edu (Kemi Jona) 

   I do something similar, the following is the best I could come up with.  If
   you hear of a better way please let me know.  Basically this code acts just
   like format, except it sends output to a fred-window bound to
   *debug-window*.  After outputting the text it checks to see if
   (window-cursor-mark) is not visible and if so moves the window-start-mark
   to 80 characters less than the length of the buffer.  This doesn't keep the
   last line of the buffer as the last line in the window, but it does make
   sure that the most recent output is always visible.  THe important part is
   to call (window-update) so everything will become visible.

   (defmacro comment (format-string &rest args)
     `(when *comments*
	  (format *debug-window* ,format-string ,@args)
	  (ask *debug-window* 
	    (if (minusp (window-vpos))
	      (set-mark (window-start-mark)
			(if (< (buffer-size (window-buffer)) 80) 0
			    (- (buffer-size (window-buffer)) 80))))
	 (t (format t ,format-string ,@args)))

Kemi's code is helpful in using WINDOW-VPOS to avoid repositioning
until output extends below the bottom of the window. 
What I'm looking for is a way to scroll the buffer up some
integral number of lines, say 5, when this happens.
All the buffer commands seem to work in terms of character positions.