Last active
March 3, 2017 08:45
-
-
Save gpittarelli/52ae21e8d0add764ac83b083d142529e to your computer and use it in GitHub Desktop.
Scroll through time, not space! like xkcd 2806, in emacs
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
(defun mwheel-scroll (event) | |
(interactive (list last-input-event)) | |
(let ((button (mwheel-event-button event))) | |
(cond ((eq button mouse-wheel-down-event) | |
(undo-tree-undo)) | |
((eq button mouse-wheel-up-event) | |
(undo-tree-redo))))) | |
;; ^ global override for all scrollwheel events | |
;; to do it only for shift+scroll, try: | |
(defun mwheel-scroll-through-time (event) | |
(interactive (list last-input-event)) | |
(let ((button (mwheel-event-button event))) | |
(cond ((eq button mouse-wheel-down-event) | |
(undo-tree-undo)) | |
((eq button mouse-wheel-up-event) | |
(undo-tree-redo))))) | |
(global-set-key (kbd "<S-mouse-4>") 'mwheel-scroll-through-time) | |
(global-set-key (kbd "<S-mouse-5>") 'mwheel-scroll-through-time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lets you do the "scrolling through time instead of space" of the title text of https://xkcd.com/1806/ in emacs :)
You'll need to
M-x package-install RET undo-tree
if you don't have undo-tree yet (provides easy undo-tree-{undo,redo})Demo (undoing/redoing over me implementing this) at https://www.gjp.cc/i/scroll-so-fast.webm