Skip to content

Instantly share code, notes, and snippets.

@ffevotte
Created April 5, 2013 21:34
Show Gist options
  • Save ffevotte/5322803 to your computer and use it in GitHub Desktop.
Save ffevotte/5322803 to your computer and use it in GitHub Desktop.
Keyboard scrolling with acceleration
(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