Created
April 5, 2013 21:34
-
-
Save ffevotte/5322803 to your computer and use it in GitHub Desktop.
Keyboard scrolling with acceleration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq my-scroll-counter 0) | |
(setq my-scroll-limit 5) | |
(setq my-last-scroll 0) | |
(setq my-scroll-interval 0.1) | |
(defun up1() | |
(interactive) | |
(let ((now (float-time))) | |
(if (and (eq last-command this-command) | |
(< (- now my-last-scroll) my-scroll-interval)) | |
(incf my-scroll-counter) | |
(setq my-scroll-counter 0)) | |
(setq my-last-scroll now)) | |
(if (> my-scroll-counter my-scroll-limit) | |
(scroll-up 2) | |
(scroll-up 1))) | |
(global-set-key "!" 'up1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment