Does Emacs have the capability to open recent files (e.g. a menu like File > Open Recent...)?
I know that Aquamacs, for OS X, has this feature. But is it common to all Emacs versions?
The most idiomatic method of providing this functionality that I know of is through the use of recentf-mode
(more here). I enable it in my initialization file with:
(require 'recentf)
(recentf-mode 1)
It then provides an interactive function, recentf-open-files
, which I bind to C-x f
, which provides a numbered menu of recently opened files that spans sessions, i.e. even if you shut down emacs and restart it, it will retain your recently opened files. You can bind the function to an accelerator with another line in your initialization file, like:
(global-set-key "\C-xf" 'recentf-open-files)
(Optional)
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)
Ordinary GNU Emacs doesn't have a menu showing recently open files. However, all Emacs commands have history, including find-file
(C-x C-f
). Selecting “File | Open” in the menu or opening a file with emacsclient
also adds to this history. After you press C-x C-f
, press up
and down
to navigate the history of opened files.
The history is saved between sessions if you enable session saving with the desktop
package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With