Find files faster with the recent files package
I bet the majority of files you edit on a day-to-day basis are the same ones over, and over again. For that reason I recommend you use Emacs’s
recentf package, it is a great – and very sophisticated, like all things Emacs – utility that keeps track of recently used files.
recentf by adding Ido mode support (if you don’t know what Ido is, read Introduction to Ido Mode); and by overriding
C-x C-r, bound to
find-file-read-only, a useless feature I never use. Note: the Ido supercharging only works if you have ido-mode enabled in the first place!
Note that unlike
find-file I’ve opted to display the entire filepath in Ido’s completion engine as I often find that a directory or remote host is the only disambiguator if there are multiple files with the same name. I’ve thought about filtering the list of recent files through the
uniquify module for buffers but that’s for another time.
Here’s what you need to add to your .emacs:
(require 'recentf) ;; get rid of `find-file-read-only' and replace it with something ;; more useful. (global-set-key (kbd "C-x C-r") 'ido-recentf-open) ;; enable recent files mode. (recentf-mode t) ; 50 files ought to be enough. (setq recentf-max-saved-items 50) (defun ido-recentf-open () "Use `ido-completing-read' to \\[find-file] a recent file" (interactive) (if (find-file (ido-completing-read "Find recent file: " recentf-list)) (message "Opening file...") (message "Aborting")))