# HG changeset patch # User Chong Yidong # Date 1252876145 0 # Node ID e78ee4d53b0215a9a3159c49f8366e676696842e # Parent f665043359a7ee2a84a3a42b9cb05db2bc3a8ae8 * recentf.el (recentf-cleanup): Use a hash table to find duplicates (Bug#4407). diff -r f665043359a7 -r e78ee4d53b02 lisp/ChangeLog --- a/lisp/ChangeLog Sun Sep 13 20:48:09 2009 +0000 +++ b/lisp/ChangeLog Sun Sep 13 21:09:05 2009 +0000 @@ -1,3 +1,8 @@ +2009-09-13 Vincent Belaïche + + * recentf.el (recentf-cleanup): Use a hash table to find + duplicates (Bug#4407). + 2009-09-13 Per Starbäck (tiny change) * textmodes/ispell.el (ispell-command-loop): Convert keys such as diff -r f665043359a7 -r e78ee4d53b02 lisp/recentf.el --- a/lisp/recentf.el Sun Sep 13 20:48:09 2009 +0000 +++ b/lisp/recentf.el Sun Sep 13 21:09:05 2009 +0000 @@ -1307,13 +1307,20 @@ That is, remove duplicates, non-kept, and excluded files." (interactive) (message "Cleaning up the recentf list...") - (let ((n 0) newlist) + (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)) + (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 (recentf-string-member f newlist))) - (push f newlist) + (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)