Next: , Previous: , Up: Customisation  


Q3.5.3: How do I bind C-. and C-; to scroll one line up and down?

Add the following (Thanks to Richard Mlynarik and Wayne Newberry) to .emacs:

(defun scroll-up-one-line ()
  (interactive)
  (scroll-up 1))

(defun scroll-down-one-line ()
  (interactive)
  (scroll-down 1))

(global-set-key [(control ?.)] 'scroll-up-one-line) ; C-.
(global-set-key [(control ?;)] 'scroll-down-one-line) ; C-;

The key point is that you can only bind simple functions to keys; you can not bind a key to a function that you’re also passing arguments to. (see Q3.5.1 for a better answer).