I want to get rid of invalid recentf entries, that is buffers that no longer exist on disk, because I renamed or just plain deleted them ; I just did a M-x recentf-cleanup and apparently lost all my history :/ what would be a sure and safe way to clean this list up?

  • 1
    What's the value of the variable recentf-exclude and the value of recentf-keep?
    – NickD
    Commented Jan 4, 2021 at 2:15

1 Answer 1


recentf-cleanup shouldn't remove all your history. According to the documentation (C-h f recentf-cleanup RET):

recentf-cleanup is an interactive compiled Lisp function in ‘recentf.el’.


Cleanup the recent list. That is, remove duplicates, non-kept, and excluded files.

One can also edit recentf list manually with the following bit of elisp :

(delete "/the/file/you/want/to/remove.example" recentf-list)

(I'm not an expert, it may introduce bugs or there's probably a cleaner/more appropriate way to do it, I don't know. But it appears to work on my emacs.)

Edit : There's also :

M-x recentf-edit-list RET

recentf-edit-list is an interactive compiled Lisp function in ` recentf.el'.


Show a dialog to delete selected files from the recent list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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