Path: utzoo!utgpu!attcan!uunet!husc6!ukma!tut.cis.ohio-state.edu!osu-cis!att!oucsace!norden From: norden@oucsace.cs.OHIOU.EDU (Jeffrey Norden) Newsgroups: comp.emacs Subject: Re: Can scrolling be changed? Summary: Yes. Message-ID: <341@oucsace.cs.OHIOU.EDU> Date: 3 Nov 88 23:53:53 GMT References: <392@megatek.UUCP> <3097@mipos3.intel.com> <2120@bucsb.UUCP> <347@talos.UUCP> Reply-To: norden@oucsace.UUCP (Jeff Norden) Organization: Ohio University CS Dept., Athens Lines: 34 In article <347@talos.UUCP> kjones@talos.UUCP (Kyle Jones) writes: >>Can it be made to scroll one line at a time up or down like a regular >>terminal? >> ..can this be fixed so no matter how fast i scroll >>with the arrow keys it will only go one line at a time? >No, unless you're willing (and capable!) of hacking the Emacs display >code. Here is a hackey way to get emacs to (almost) always scroll one line at a time. Put the following re-defintions of next-line and prev-line in your .emacs file: ------------------------------------------------------------------------------ ;; My own versions of next-line and previous-line. These almost never recenter ;; the buffer. (defun next-line (arg) (interactive"p") (if (> arg 0) (setq dir 1) (setq dir -1)) (while (not (pos-visible-in-window-p (save-excursion (line-move arg) (point)))) (scroll-up dir)) (line-move arg)) (defun previous-line (arg) (interactive"p") (next-line (- arg))) ------------------------------------------------------------------------------ My own feeling is that scroll-step should be extended to allow you to do this. A reasonable extension would be to have (setq scroll-step -1) cause emacs to always scroll by the minimum number of lines needed to bring the point back onto the screen. I've been meaning to do this for a while (hacking at the c-code is necessary), I might have some time next month. If I'm successful, I'll post the results. -Jeff Norden, norden@ace.cs.ohio.edu Dept of Math, Ohio Univ, Athens OH 45701