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

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

Scrolling while keeping point fixed


From: deech
Subject: Scrolling while keeping point fixed
Date: Thu, 18 Dec 2008 13:44:03 -0800 (PST)
User-agent: G2/1.0

Hi all,
The following snippet in my .emacs file allows me scroll while keeping
the cursor at its present location. Please note that C-M-t (transpose-
sexps) is clobbered by these keybindings.

(defun keep-point-and-scroll-down ()
  (interactive)
  (save-excursion
    (View-scroll-line-forward)))

(defun keep-point-and-scroll-up ()
  (interactive)
  (save-excursion
    (View-scroll-line-backward)))

(global-unset-key "\C-\M-y")
(global-set-key   "\C-\M-y" 'keep-point-and-scroll-down)
(global-unset-key "\C-\M-t")
(global-set-key   "\C-\M-t" 'keep-point-and-scroll-up)

-deech


reply via email to

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