help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Buffer Positioning


From: Alan Mackenzie
Subject: Re: Buffer Positioning
Date: Sat, 11 Jan 2003 08:46:00 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

CarlC <carlc@snowbd.com> wrote on Fri, 10 Jan 2003 15:26:27 GMT:
> Hi, All.

[ .... ]

> 2) How can I get arrow up/down to scroll the buffer by one line? If my
> cursor is on the last line of the window, I want a down arrow to remain
> at the bottom of the window (on the next line of the buffer).

Firstly, are you SURE you want arrow up/down to scroll the buffer?  If
so, you won't be able to use these keys for moving the cursor, and will
need C-n and C-p for these purposes.

My solution is to have these function definitions in my .emacs:

*************************************************************************
(defun scrollup-n (&optional n)
  "Scroll the text up n (default 1) lines."
  (interactive "p")
  (scroll-up (or n 1))
)
(global-set-key [S-down] 'scrollup-n)

(defun scrolldown-n (&optional n)
  "Scroll the text down n (default 1) lines."
  (interactive "p")
  (scroll-down (or n 1))
)
(global-set-key [S-up] 'scrolldown-n)

(defun scrollup-6n (&optional n)
  "Scroll the text up 6n (default 6) lines."
  (interactive "p")
  (scroll-up (* 6 (or n 1)))
)
(global-set-key [C-S-down] 'scrollup-6n)

(defun scrolldown-6n (&optional n)
  "Scroll the text down 6n (default 6) lines."
  (interactive "p")
  (scroll-down (* 6 (or n 1)))
)
(global-set-key [C-S-up] 'scrolldown-6n)
*************************************************************************

As can be seen, I use SHIFT-up/down for scrolling by a single line, and
Control-shift-up/down for scrolling six lines at a time.  You can modify
the global-set-key calls easily enough to take the SHIFT away.

> Any comments on these functions would be welcome. Thanks.

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

[Prev in Thread] Current Thread [Next in Thread]