4

I looked around, but I couldn't find any answer in the documentation of recentf and with C-h v recent.

My default directory is set with the following:

(setq user-emacs-directory "~/home/ReneFroger/"
       default-directory "~/home/ReneFroger/")

I noticed Emacs saves the recent files that I have visited in the file recentf, which will be stored in the home/ReneFroger/ path. I would like to change the location of recentf but I can't find any variable that allows me to do this.

  • It's stored in /Users/sth/.emacs.d/.cache/recentf for me by default. – HappyFace Apr 7 at 15:40
8

You can set it with

(setq recentf-save-file (expand-file-name "recentf" <other-directory>))

You can usually find settings like this by looking at the help for one of the functions, e.g. recentf-mode, then following the link to the source code, and then doing occur for defcustom to find one that looks like it might be a file storage location - e.g. in this case you'd get

 23 matches for "defcustom" in buffer: recentf.el
 65:(defcustom recentf-max-saved-items 20
 72:(defcustom recentf-save-file (locate-user-emacs-file "recentf" ".recentf")
 85:(defcustom recentf-save-file-modes 384 ;; 0600
 94:(defcustom recentf-exclude nil
111:(defcustom recentf-keep
etc.
| improve this answer | |
  • Not only your answer, but the tip to follow the source code of recentf and then doing occur for defcustom was very valuable for me. Thanks for that! – ReneFroger Jan 20 '16 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.