I renamed few files using Dired. I noticed helm shows old names in the list of recent files (helm-recentf).

How do I remove the files that do not exist from recent files list?

  • Not sure it helps, however, just to be sure, did you try to type the 'g' letter? This is the usual key you must type to update stuff like 'dired', 'magit' etc... Commented Nov 30, 2017 at 13:13
  • Where do I type it? Commented Nov 30, 2017 at 13:23
  • 1
    Thank you Picaud but this does not work with helm-recentf. Because it only shows a text field that is used to filter the list of recent files. As soon as I type g it is evaluated as the search pattern. Commented Nov 30, 2017 at 13:58

1 Answer 1


How do I remove the files that do not exist from recent files list?


recentf-cleanup is an interactive compiled Lisp function in


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

See also the user options recentf-auto-cleanup:

recentf-auto-cleanup is a variable defined in ‘recentf.el’.
Its value is ‘mode’

Define when to automatically cleanup the recent list.
The following values can be set:

- ‘mode’
Cleanup when turning the mode on (default).
- ‘never’
Never cleanup the list automatically.
- A number
Cleanup each time Emacs has been idle that number of seconds.
- A time string
Cleanup at specified time string, for example at "11:00pm".

Setting this variable directly does not take effect;
use M-x customize.

See also the command ‘recentf-cleanup’, that can be used to manually
cleanup the list.

You can customize this variable.

as well as recentf-keep and recentf-exclude for more granular control over what is allowed into recentf-list. The default value of recentf-keep ensures non-readable files are removed from the list.

See also M-xrecentf-edit-listRET:

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


Show a dialog to delete selected files from the recent list.
  • Wouldn't make more sense to set a maximum length for the history?
    – rph
    Commented Jun 20, 2019 at 17:24
  • @rph Sorry, I fail to see what history length has to do with either the question in the OP or my answer. The question is clearly about removing non-existent files from the cached recent file list.
    – Basil
    Commented Jun 20, 2019 at 23:31
  • I keep cleaning my list but whenevet I reopen my emacs daemon everyhing shows up again @Basil
    – alper
    Commented May 3, 2020 at 12:49
  • 1
    @alper recentf-cleanup does not empty recentf-list. Try setting recentf-list to the empty list, either directly or by calling recentf-edit-list, followed by recentf-save-list.
    – Basil
    Commented May 3, 2020 at 13:04
  • 1
    @HappyFace customize-set-value is only useful for interactive use, or for setting a variable-comment property; otherwise you can just use setq or setq-default. If you want the function recentf-auto-cleanup to be called after you set the user option recentf-auto-cleanup, then you should use customize-set-variable instead, as this makes sure to call the user option's custom :set function.
    – Basil
    Commented Aug 10, 2020 at 9:07

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.