Function: recentf-cleanup

recentf-cleanup is an interactive and byte-compiled function defined in recentf.el.gz.

Signature

(recentf-cleanup)

Documentation

Cleanup the recent list.

That is, remove duplicates, non-kept, and excluded files.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/recentf.el.gz
(defun recentf-cleanup ()
  "Cleanup the recent list.
That is, remove duplicates, non-kept, and excluded files."
  (interactive)
  (message "Cleaning up the recentf list...")
  (let ((n 0)
	(ht (make-hash-table
	     :size recentf-max-saved-items
	     :test 'equal))
	newlist key)
    (dolist (f recentf-list)
      (setq f (recentf-expand-file-name f)
	    key (if recentf-case-fold-search (downcase f) f))
      (if (and (recentf-include-p f)
               (recentf-keep-p f)
               (not (gethash key ht)))
	  (progn
	    (push f newlist)
	    (puthash key t ht))
        (setq n (1+ n))
        (message "File %s removed from the recentf list" f)))
    (message "Cleaning up the recentf list...done (%d removed)" n)
    (setq recentf-list (nreverse newlist))))