Emacs, scroll page without moving point

Emacs, scroll page without moving point

I’ve been trying to find a way to move up and down a page, without actually moving the point. It’s good if you want to take a look around the file.

Just found this cool snippet on:

https://www.emacswiki.org/emacs/Scrolling

that seams to do the trick, but I mapped to different keys M + p and M + n, and also changed the speed of the scroll to 4.

1
2
3
4
5
6
7
8
(defun gcm-scroll-down ()
      (interactive)
      (scroll-up 4))
(defun gcm-scroll-up ()
      (interactive)
      (scroll-down 4))
(global-set-key (kbd "M-p") 'gcm-scroll-up)
(global-set-key (kbd "M-n") 'gcm-scroll-down)