Recent files in Emacs

I think you will be glad to add this mode to your ~/.emacs file if you use Emacs as your primary text editor or IDE:
;Enable recentf (recent files mode)
;M-x recentf-mode
(require ‘recentf)
(recentf-mode 1)
(global-set-key (kbd “C-x C-g”) ‘recentf-open-files)
;If you make extensive use of Tramp, recentf will track those files too, and do it’s periodic cleanup thing which can be a real mess since the files are remote. Prevent this by putting this in your startup file:
(setq recentf-auto-cleanup ‘never)

This way every time you need to access an often used file just press C-x C-g.
Of course this can be mapped to anywhere else – and I’m sure C-x C-d is far convenient, but as I like to keep things vanilla because this easies to work on different systems not owned by me I prefer to bind recentf-mode to an unused key combination.



Leave a Reply