diff options
Diffstat (limited to 'lisp/gnus/gnus-cache.el')
-rw-r--r-- | lisp/gnus/gnus-cache.el | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el index 0378443377f..5e6483d1053 100644 --- a/lisp/gnus/gnus-cache.el +++ b/lisp/gnus/gnus-cache.el @@ -272,7 +272,7 @@ it's not cached." (defun gnus-cache-possibly-alter-active (group active) "Alter the ACTIVE info for GROUP to reflect the articles in the cache." (when gnus-cache-active-hashtb - (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) + (let ((cache-active (gethash group gnus-cache-active-hashtb))) (when cache-active (when (< (car cache-active) (car active)) (setcar active (car cache-active))) @@ -522,7 +522,7 @@ system for example was used.") (gnus-delete-line))) (unless (setq gnus-newsgroup-cached (delq article gnus-newsgroup-cached)) - (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb) + (remhash gnus-newsgroup-name gnus-cache-active-hashtb) (setq gnus-cache-active-altered t)) (gnus-summary-update-secondary-mark article) t))) @@ -542,8 +542,8 @@ system for example was used.") (progn (gnus-cache-update-active group (car articles) t) (gnus-cache-update-active group (car (last articles)))) - (when (gnus-gethash group gnus-cache-active-hashtb) - (gnus-sethash group nil gnus-cache-active-hashtb) + (when (gethash group gnus-cache-active-hashtb) + (remhash group gnus-cache-active-hashtb) (setq gnus-cache-active-altered t))) articles))) @@ -666,13 +666,16 @@ $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache" ;; Mark the active hashtb as unaltered. (setq gnus-cache-active-altered nil))) +;; FIXME: Why is there a `gnus-cache-possibly-alter-active', +;; `gnus-cache-possibly-update-active', and +;; `gnus-cache-update-active'? Do we really need all three? (defun gnus-cache-possibly-update-active (group active) "Update active info bounds of GROUP with ACTIVE if necessary. The update is performed if ACTIVE contains a higher or lower bound than the current." (let ((lower t) (higher t)) (if gnus-cache-active-hashtb - (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb))) + (let ((cache-active (gethash group gnus-cache-active-hashtb))) (when cache-active (unless (< (car active) (car cache-active)) (setq lower nil)) @@ -687,10 +690,10 @@ than the current." (defun gnus-cache-update-active (group number &optional low) "Update the upper bound of the active info of GROUP to NUMBER. If LOW, update the lower bound instead." - (let ((active (gnus-gethash group gnus-cache-active-hashtb))) + (let ((active (gethash group gnus-cache-active-hashtb))) (if (null active) ;; We just create a new active entry for this group. - (gnus-sethash group (cons number number) gnus-cache-active-hashtb) + (puthash group (cons number number) gnus-cache-active-hashtb) ;; Update the lower or upper bound. (if low (setcar active number) @@ -734,10 +737,10 @@ If LOW, update the lower bound instead." ;; FIXME: this is kind of a workaround. The active file should ;; be updated at the time articles are cached. It will make ;; `gnus-cache-unified-group-names' needless. - (gnus-sethash (or (cdr (assoc group gnus-cache-unified-group-names)) - group) - (cons (car nums) (car (last nums))) - gnus-cache-active-hashtb)) + (puthash (or (cdr (assoc group gnus-cache-unified-group-names)) + group) + (cons (car nums) (car (last nums))) + gnus-cache-active-hashtb)) ;; Go through all the other files. (dolist (file alphs) (when (and (file-directory-p file) @@ -798,13 +801,13 @@ supported." (unless gnus-cache-active-hashtb (gnus-cache-read-active)) (let* ((old-group-hash-value - (gnus-gethash old-group gnus-cache-active-hashtb)) + (gethash old-group gnus-cache-active-hashtb)) (new-group-hash-value - (gnus-gethash new-group gnus-cache-active-hashtb)) + (gethash new-group gnus-cache-active-hashtb)) (delta (or old-group-hash-value new-group-hash-value))) - (gnus-sethash new-group old-group-hash-value gnus-cache-active-hashtb) - (gnus-sethash old-group nil gnus-cache-active-hashtb) + (puthash new-group old-group-hash-value gnus-cache-active-hashtb) + (puthash old-group nil gnus-cache-active-hashtb) (if no-save (setq gnus-cache-active-altered delta) @@ -826,8 +829,8 @@ supported." (let ((no-save gnus-cache-active-hashtb)) (unless gnus-cache-active-hashtb (gnus-cache-read-active)) - (let* ((group-hash-value (gnus-gethash group gnus-cache-active-hashtb))) - (gnus-sethash group nil gnus-cache-active-hashtb) + (let* ((group-hash-value (gethash group gnus-cache-active-hashtb))) + (remhash group gnus-cache-active-hashtb) (if no-save (setq gnus-cache-active-altered group-hash-value) @@ -849,9 +852,9 @@ supported." (when gnus-cache-total-fetched-hashtb (gnus-cache-with-refreshed-group group - (let* ((entry (or (gnus-gethash group gnus-cache-total-fetched-hashtb) - (gnus-sethash group (make-vector 2 0) - gnus-cache-total-fetched-hashtb))) + (let* ((entry (or (gethash group gnus-cache-total-fetched-hashtb) + (puthash group (make-vector 2 0) + gnus-cache-total-fetched-hashtb))) size) (if file @@ -874,8 +877,8 @@ supported." (when gnus-cache-total-fetched-hashtb (gnus-cache-with-refreshed-group group - (let* ((entry (or (gnus-gethash group gnus-cache-total-fetched-hashtb) - (gnus-sethash group (make-list 2 0) + (let* ((entry (or (gethash group gnus-cache-total-fetched-hashtb) + (puthash group (make-list 2 0) gnus-cache-total-fetched-hashtb))) (file-name-coding-system nnmail-pathname-coding-system) (size (or (file-attribute-size (file-attributes @@ -888,22 +891,21 @@ supported." (defun gnus-cache-rename-group-total-fetched-for (old-group new-group) "Record of disk space used by OLD-GROUP now associated with NEW-GROUP." (when gnus-cache-total-fetched-hashtb - (let ((entry (gnus-gethash old-group gnus-cache-total-fetched-hashtb))) - (gnus-sethash new-group entry gnus-cache-total-fetched-hashtb) - (gnus-sethash old-group nil gnus-cache-total-fetched-hashtb)))) + (let ((entry (gethash old-group gnus-cache-total-fetched-hashtb))) + (puthash new-group entry gnus-cache-total-fetched-hashtb) + (remhash old-group gnus-cache-total-fetched-hashtb)))) (defun gnus-cache-delete-group-total-fetched-for (group) "Delete record of disk space used by GROUP being deleted." (when gnus-cache-total-fetched-hashtb - (gnus-sethash group nil gnus-cache-total-fetched-hashtb))) + (remhash group gnus-cache-total-fetched-hashtb))) (defun gnus-cache-total-fetched-for (group &optional no-inhibit) "Get total disk space used by the cache for the specified GROUP." (unless (equal group "dummy.group") (unless gnus-cache-total-fetched-hashtb - (setq gnus-cache-total-fetched-hashtb (gnus-make-hashtable 1024))) - - (let* ((entry (gnus-gethash group gnus-cache-total-fetched-hashtb))) + (setq gnus-cache-total-fetched-hashtb (gnus-make-hashtable 1000))) + (let* ((entry (gethash group gnus-cache-total-fetched-hashtb))) (if entry (apply '+ entry) (let ((gnus-cache-inhibit-update-total-fetched-for (not no-inhibit))) |