Emacs: scroll buffer not point

;;;_*======================================================================
;;;_* define a function to scroll with the cursor in place, moving the
;;;_* page instead
;; Navigation Functions
(defun scroll-down-in-place (n)
  (interactive "p")
  (previous-line n)
  (unless (eq (window-start) (point-min))
    (scroll-down n)))

(defun scroll-up-in-place (n)
  (interactive "p")
  (next-line n)
  (unless (eq (window-end) (point-max))
    (scroll-up n)))

(global-set-key "\M-n" 'scroll-up-in-place)
(global-set-key "\M-p" 'scroll-down-in-place)

This might be of use. According to the EmacsWiki page on Scrolling;

The variable scroll-preserve-screen-position may be useful to some. When you scroll down, and up again, point should end up at the same position you started out with. The value can be toggled by the built in mode M-x scroll-lock-mode.


try these. Change M-n and M-p key bindings according to your taste

;;; scrollers
(global-set-key "\M-n" "\C-u1\C-v")
(global-set-key "\M-p" "\C-u1\M-v")

Tags:

Emacs