aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-09-13 21:09:05 +0000
committerChong Yidong2009-09-13 21:09:05 +0000
commit1fc26e29ba1383a2daeb5321ed03d04bc1a7669b (patch)
tree77f77c5ef4e5fa61bdddca36f3e80f1c2eb2e76a
parentadcdf8bc815ffcd32cd434f14f011855dffa2c1e (diff)
downloademacs-1fc26e29ba1383a2daeb5321ed03d04bc1a7669b.tar.gz
emacs-1fc26e29ba1383a2daeb5321ed03d04bc1a7669b.zip
* recentf.el (recentf-cleanup): Use a hash table to find
duplicates (Bug#4407).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/recentf.el15
2 files changed, 16 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 11bfa9bce85..0ad8e2f07cf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-09-13 Vincent Belaïche <vincent.belaiche@gmail.com>
2
3 * recentf.el (recentf-cleanup): Use a hash table to find
4 duplicates (Bug#4407).
5
12009-09-13 Per Starbäck <per@starback.se> (tiny change) 62009-09-13 Per Starbäck <per@starback.se> (tiny change)
2 7
3 * textmodes/ispell.el (ispell-command-loop): Convert keys such as 8 * textmodes/ispell.el (ispell-command-loop): Convert keys such as
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."
1307That is, remove duplicates, non-kept, and excluded files." 1307That is, remove duplicates, non-kept, and excluded files."
1308 (interactive) 1308 (interactive)
1309 (message "Cleaning up the recentf list...") 1309 (message "Cleaning up the recentf list...")
1310 (let ((n 0) newlist) 1310 (let ((n 0)
1311 (ht (make-hash-table
1312 :size recentf-max-saved-items
1313 :test 'equal))
1314 newlist key)
1311 (dolist (f recentf-list) 1315 (dolist (f recentf-list)
1312 (setq f (recentf-expand-file-name f)) 1316 (setq f (recentf-expand-file-name f)
1317 key (if recentf-case-fold-search (downcase f) f))
1313 (if (and (recentf-include-p f) 1318 (if (and (recentf-include-p f)
1314 (recentf-keep-p f) 1319 (recentf-keep-p f)
1315 (not (recentf-string-member f newlist))) 1320 (not (gethash key ht)))
1316 (push f newlist) 1321 (progn
1322 (push f newlist)
1323 (puthash key t ht))
1317 (setq n (1+ n)) 1324 (setq n (1+ n))
1318 (message "File %s removed from the recentf list" f))) 1325 (message "File %s removed from the recentf list" f)))
1319 (message "Cleaning up the recentf list...done (%d removed)" n) 1326 (message "Cleaning up the recentf list...done (%d removed)" n)