Pete's Linux Advent Calendar 2008
The 16th day
More Emacs functions
With these two functions you can scroll in a buffer up or down
leaving the cursor at the relative position:
(defun move-up ()
"moves the buffer up one line, leaving cursor at relative position."
(interactive)
(forward-line 1)
(scroll-up 1))
(defun move-down ()
"moves the buffer down one line, leaving cursor at relative position."
(interactive)
(forward-line -1)
(scroll-down 1))
(global-set-key "\M-n" 'move-up)
(global-set-key "\M-p" 'move-down)