Because the behaviors of Emacs built-in recentf
has frustrated me for over 10 years. I’m never able to understand what on earth it is doing.
A simple and stupid recents list, without any confusing behaviors – just do what you mean, like any other IDE or editor. (I’ve falled into self-doubt for years whenever thinking that I have to implement such feature for a text editor in 2024.)
- Minimalized, no confusing behavior, no extra dependency (only relys on `cl-lib`). Fuzzy search is provided by Ido (Emacs built-in) or Helm (need installation).
- Never caches, even never stores anything in memory. (Everything are stored as a plaintext file in
~/.emacs.d/.recentz-data
.) - Never loses any item after exiting Emacs. (Even an unexpected exit or crash)
- Always synchronized recents list between multiple Emacs instances.
- Always automatically removes items which is no longer existed in file system.
- Recorded lists: files / directories / projects (directories controlled by VC, ex:
git
)
(require 'recentz)
(setq recentz-ignore-path-patterns '("/COMMIT_EDITMSG$" "~$" "/node_modules/"))
;; If you prefer (Emacs built-in) IDO
(global-set-key (kbd "C-x C-r") 'recentz-files)
(global-set-key (kbd "C-x C-d") 'recentz-directories)
(global-set-key (kbd "C-x C-p") 'recentz-projects)
;; If you prefer Helm
(global-set-key (kbd "C-x C-r") 'helm-recentz-files)
(global-set-key (kbd "C-x C-d") 'helm-recentz-directories)
(global-set-key (kbd "C-x C-p") 'helm-recentz-projects)
You may also want to add .recentz-data
into .gitignore
, if you manage your .emacs.d
via git
:
cd ~/.emacs.d && echo ".recentz-data" >> .gitignore
GPLv3