diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2009-09-13 21:09:05 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2009-09-13 21:09:05 +0000 |
commit | 1fc26e29ba1383a2daeb5321ed03d04bc1a7669b (patch) | |
tree | 77f77c5ef4e5fa61bdddca36f3e80f1c2eb2e76a /lisp/recentf.el | |
parent | adcdf8bc815ffcd32cd434f14f011855dffa2c1e (diff) | |
download | emacs-1fc26e29ba1383a2daeb5321ed03d04bc1a7669b.tar.gz emacs-1fc26e29ba1383a2daeb5321ed03d04bc1a7669b.tar.bz2 emacs-1fc26e29ba1383a2daeb5321ed03d04bc1a7669b.zip |
* recentf.el (recentf-cleanup): Use a hash table to find
duplicates (Bug#4407).
Diffstat (limited to 'lisp/recentf.el')
-rw-r--r-- | lisp/recentf.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/recentf.el b/lisp/recentf.el index bc8904f9211..c0fa933840a 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -1307,13 +1307,20 @@ empty `file-name-history' with the recent list." 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) |