Skip to content

Instantly share code, notes, and snippets.

@Frozenlock
Created July 28, 2012 21:44
Show Gist options
  • Save Frozenlock/3194922 to your computer and use it in GitHub Desktop.
Save Frozenlock/3194922 to your computer and use it in GitHub Desktop.
Open command shows a list of recent file
;----------------------------------------------------
;;;==== Open command shows a list of recent file ====
;----------------------------------------------------
(require 'recentf)
;; enable recent files mode.
(recentf-mode t)
; 200 files ought to be enough.
(setq recentf-max-saved-items 200)
(defun ido-recentf-open ()
"Use `ido-completing-read' to \\[find-file] a recent file"
(interactive)
(if (find-file (ido-completing-read "Find recent file: "
(remove-if
'(lambda (arg) (string-match ".tex\\|.txt" arg))
recentf-list)))
(message "Opening file...")
(message "Aborting")))
(global-set-key (kbd "C-x C-f") 'ido-recentf-open) ; I never directly open a file anyway, so bind the keys with recent documents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment