emacsido-moderecent-file-list

How do I get Emacs ido-mode's recent file list to ignore uninteresting files?


How do I get Emacs ido-mode's recentf-list to ignore uninteresting files?

I'm using ido-mode with xSteve's function for ido recent files (see below for the function).

But as it is now, it displays uninteresting files first, like this:

-> ~/.ido-last
   ~/Library/Application Support/Aquamacs Emacs/recent-addresses
   ~/Documents/journal.org

So how do I get ido-mode to ignore uninteresting files like ~/.ido-last and ~/Library/Application Support/Aquamacs Emacs/recent-addresses?

P.S. Here's that function, for reference:

(defun xsteve-ido-choose-from-recentf ()
"Use ido to select a recently opened file from the `recentf-list'"
(interactive)
(let ((home (expand-file-name (getenv "HOME"))))
(find-file
 (ido-completing-read "Recentf open: "
                      (mapcar (lambda (path)
                                (replace-regexp-in-string home "~" path))
                              recentf-list)
                      nil t))))

(global-set-key [(meta f11)] 'xsteve-ido-choose-from-recentf)

Solution

  • A way to make recentf ignore some files, just add appripriate regexps to recentf-exclude list:

    (add-to-list 'recentf-exclude "\\.windows\\'")
    (add-to-list 'recentf-exclude "\\.revive\\'")
    

    This will prevent any future entries of the above from being added to the recentf list. Need to delete the current entries in your recentf file for them to be permanently removed or what until they are phased out from other entries.

    Source: Force emacs recent files using recentf to ignore specified files (.windows and .revive for example)