(defun scrollup-n (&optional n) "Scroll the text up n (default 1) lines." (interactive "p") (scroll-up (or n 1)) ) (global-set-key [S-down] 'scrollup-n) (defun scrolldown-n (&optional n) "Scroll the text down n (default 1) lines." (interactive "p") (scroll-down (or n 1)) ) (global-set-key [S-up] 'scrolldown-n) (defun scrollup-6n (&optional n) "Scroll the text up 6n (default 6) lines." (interactive "p") (scroll-up (* 6 (or n 1))) ) (global-set-key [C-S-down] 'scrollup-6n) (defun scrolldown-6n (&optional n) "Scroll the text down 6n (default 6) lines." (interactive "p") (scroll-down (* 6 (or n 1))) ) (global-set-key [C-S-up] 'scrolldown-6n) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun screen-top () "Move the point to the top of the screen." (interactive) (move-to-window-line 0) ) (global-set-key [C-left] 'screen-top) (defun screen-bottom () "Move the point to the bottom of the screen." (interactive) (move-to-window-line -1) ) (global-set-key [C-right] 'screen-bottom) (defun scroll-to-top (&optional n) "Scroll the current line to the top of the window" (interactive "P") (recenter (if n (prefix-numeric-value n) 0))) (global-set-key [C-S-right] 'scroll-to-top) (defun scroll-to-bottom (&optional n) "Scroll the current line to the bottom of the window. If given a numerical arg, leave point that many lines from the bottom." (interactive "p") (recenter (- (or n 1)))) (global-set-key [C-S-left] 'scroll-to-bottom) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun 4-column () "Disply the current buffer in 3 columns with follow-mode" (interactive) (follow-mode 1) (delete-other-windows) (split-window-horizontally) (split-window-horizontally) (split-window-horizontally) (balance-windows)) (global-set-key "\C-c4" '4-column) (defun 3-column () "Disply the current buffer in 3 columns with follow-mode" (interactive) (follow-mode 1) (delete-other-windows) (split-window-horizontally) (split-window-horizontally) (balance-windows)) (global-set-key "\C-c3" '3-column) (defun 2-column () "Disply the current buffer in 2 columns with follow-mode" (interactive) (follow-mode 1) (delete-other-windows) (split-window-horizontally) (balance-windows)) (global-set-key "\C-c2" '2-column) (global-set-key "\C-c0" (lambda () (interactive) (message "follow-mode disabled") (follow-mode 0))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun do-vm (arg) "Do (vertical-motion ARG), where ARG is a number, default of 0." (interactive "P") (vertical-motion (if arg (prefix-numeric-value arg) 0))) (global-set-key "\C-cm" 'do-vm)