Skip to content

Instantly share code, notes, and snippets.

@chrisschreiner
Created April 13, 2010 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisschreiner/364954 to your computer and use it in GitHub Desktop.
Save chrisschreiner/364954 to your computer and use it in GitHub Desktop.
Jump to recent file via Ctrl-#
(defvar shortcut-list '(1 2 3 4 5))
(defun unset-numeric-shortcuts (list)
(mapcar
'(lambda (n)
(global-unset-key (read-kbd-macro (format "C-%d" n))))
list))
(unset-numeric-shortcuts shortcut-list)
(defun frm-2 (list)
(apply 'concat (mapcar '(lambda (n)
(format "C-%d %s " n (elt (buffer-list) (1- n)))
)
list)))
(defun switch-to (name-of-buffer list)
(switch-to-buffer name-of-buffer t)
(message (format "Switching to %s <= %s" name-of-buffer (frm-2 list))))
(defun map-it (list)
(mapcar 'eval
(mapcar '(lambda (e)
`(global-set-key
(read-kbd-macro ,(format "C-%s" e))
(lambda () (interactive)
(switch-to (buffer-name (elt (buffer-list) ,(1- e))) ',list))))
list)))
(global-set-key (kbd "C-0") (lambda () (interactive) (message (frm-2 shortcut-list))))
(map-it shortcut-list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment