The Essentials of Recentf
What it is
recentf a minor mode that keeps a list of your recently opened files
Enable it!
(recentf-mode t)
Assign a shortcut key, which is usually:
(global-set-key (kbd "C-x C-r") 'recentf-open-files)
Decide on the maximum number of items to show
(setq recentf-max-menu-items 10) (setq recentf-max-saved-items 50)
Save the list periodically
The list is usually saved before exiting Emacs. If you exit suddenly, it may not be saved. It is a good idea therefore to save periodically:
(run-at-time nil (* 5 60) 'recentf-save-list)
You can exclude certain files from the list
I prefer to do this through the CUI:
'(recentf-exclude
'("\\.el$" "\\log$" "diary" "/\\'" "\\.yml$" "bookmark" "\\.el\\.gz$"))
This example excludes files of certain types, files with certain strings, and all recently accessed directories. I like to have only files there.
Clean up the list
The variable recentf-auto-cleanup will clean up the list for you. The default is "mode" and I keep it that way. What this "cleanup" involves is vague. However, it is certain that it:
- Removes defunct links (files deleted or moved)
- Removes duplicates
Show true filenames not abbreviated ones
'(recentf-filename-handlers '(file-truename))
Note: the numbers in the recentf list are quick keys
That's why there are only 10!