4

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... – Picaud Vincent Nov 30 '17 at 13:13
  • Where do I type it? – Andrew-Dufresne Nov 30 '17 at 13:23
  • 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. – Andrew-Dufresne Nov 30 '17 at 13:58
9

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

M-xrecentf-cleanupRET

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

(recentf-cleanup)

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’

Documentation:
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'.

(recentf-edit-list)

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 Jun 20 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 Jun 20 at 23:31

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.