1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-20 15:10:37 -08:00

* lisp/gnus/*registry.el: Use slot names rather than initarg names

* lisp/gnus/registry.el (registry-lookup-breaks-before-lexbind)
(registry-search, registry-delete, registry-size, registry-insert)
(registry-reindex, registry-collect-prune-candidates, registry-lookup):
* lisp/gnus/gnus-registry.el (gnus-registry-fixup-registry)
(gnus-registry-remove-extra-data): Use slot names rather than initarg
names in `oref' and `oset'.
This commit is contained in:
Stefan Monnier 2015-03-06 23:50:32 -05:00
parent 0ea68311a5
commit 35e2b6ab4d
3 changed files with 30 additions and 21 deletions

View file

@ -1,3 +1,12 @@
2015-03-07 Stefan Monnier <monnier@iro.umontreal.ca>
* registry.el (registry-lookup-breaks-before-lexbind, registry-lookup)
(registry-search, registry-delete, registry-size, registry-insert)
(registry-reindex, registry-collect-prune-candidates):
* gnus-registry.el (gnus-registry-fixup-registry)
(gnus-registry-remove-extra-data): Use slot names rather than initarg
names in `oref' and `oset'.
2015-02-26 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part):

View file

@ -276,20 +276,20 @@ This can slow pruning down. Set to nil to perform no sorting."
(defun gnus-registry-fixup-registry (db)
(when db
(let ((old (oref db :tracked)))
(oset db :precious
(let ((old (oref db tracked)))
(oset db precious
(append gnus-registry-extra-entries-precious
'()))
(oset db :max-size
(oset db max-size
(or gnus-registry-max-entries
most-positive-fixnum))
(oset db :prune-factor
(oset db prune-factor
(or gnus-registry-prune-factor
0.1))
(oset db :tracked
(oset db tracked
(append gnus-registry-track-extra
'(mark group keyword)))
(when (not (equal old (oref db :tracked)))
(when (not (equal old (oref db tracked)))
(gnus-message 9 "Reindexing the Gnus registry (tracked change)")
(registry-reindex db))))
db)
@ -1242,7 +1242,7 @@ from your existing entries."
(when extra
(let ((db gnus-registry-db))
(registry-reindex db)
(loop for k being the hash-keys of (oref db :data)
(loop for k being the hash-keys of (oref db data)
using (hash-value v)
do (let ((newv (delq nil (mapcar #'(lambda (entry)
(unless (member (car entry) extra)

View file

@ -155,7 +155,7 @@
(defmethod registry-lookup ((db registry-db) keys)
"Search for KEYS in the registry-db THIS.
Returns an alist of the key followed by the entry in a list, not a cons cell."
(let ((data (oref db :data)))
(let ((data (oref db data)))
(delq nil
(mapcar
(lambda (k)
@ -166,7 +166,7 @@ Returns an alist of the key followed by the entry in a list, not a cons cell."
(defmethod registry-lookup-breaks-before-lexbind ((db registry-db) keys)
"Search for KEYS in the registry-db THIS.
Returns an alist of the key followed by the entry in a list, not a cons cell."
(let ((data (oref db :data)))
(let ((data (oref db data)))
(delq nil
(loop for key in keys
when (gethash key data)
@ -227,7 +227,7 @@ The test order is to check :all first, then :member, then :regex."
(let ((all (plist-get spec :all))
(member (plist-get spec :member))
(regex (plist-get spec :regex)))
(loop for k being the hash-keys of (oref db :data)
(loop for k being the hash-keys of (oref db data)
using (hash-values v)
when (or
;; :all non-nil returns all
@ -243,10 +243,10 @@ The test order is to check :all first, then :member, then :regex."
If KEYS is nil, use SPEC to do a search.
Updates the secondary ('tracked') indices as well.
With assert non-nil, errors out if the key does not exist already."
(let* ((data (oref db :data))
(let* ((data (oref db data))
(keys (or keys
(apply 'registry-search db spec)))
(tracked (oref db :tracked)))
(tracked (oref db tracked)))
(dolist (key keys)
(let ((entry (gethash key data)))
@ -273,8 +273,8 @@ With assert non-nil, errors out if the key does not exist already."
(defmethod registry-size ((db registry-db))
"Returns the size of the registry-db object THIS.
This is the key count of the :data slot."
(hash-table-count (oref db :data)))
This is the key count of the `data' slot."
(hash-table-count (oref db data)))
(defmethod registry-full ((db registry-db))
"Checks if registry-db THIS is full."
@ -286,7 +286,7 @@ This is the key count of the :data slot."
Updates the secondary ('tracked') indices as well.
Errors out if the key exists already."
(assert (not (gethash key (oref db :data))) nil
(assert (not (gethash key (oref db data))) nil
"Key already exists in database")
(assert (not (registry-full db))
@ -294,10 +294,10 @@ Errors out if the key exists already."
"registry max-size limit reached")
;; store the entry
(puthash key entry (oref db :data))
(puthash key entry (oref db data))
;; store the secondary indices
(dolist (tr (oref db :tracked))
(dolist (tr (oref db tracked))
;; for every value in the entry under that key...
(dolist (val (cdr-safe (assq tr entry)))
(let* ((value-keys (registry-lookup-secondary-value db tr val)))
@ -308,8 +308,8 @@ Errors out if the key exists already."
(defmethod registry-reindex ((db registry-db))
"Rebuild the secondary indices of registry-db THIS."
(let ((count 0)
(expected (* (length (oref db :tracked)) (registry-size db))))
(dolist (tr (oref db :tracked))
(expected (* (length (oref db tracked)) (registry-size db))))
(dolist (tr (oref db tracked))
(let (values)
(maphash
(lambda (key v)
@ -322,7 +322,7 @@ Errors out if the key exists already."
(let* ((value-keys (registry-lookup-secondary-value db tr val)))
(push key value-keys)
(registry-lookup-secondary-value db tr val value-keys))))
(oref db :data))))))
(oref db data))))))
(defmethod registry-prune ((db registry-db) &optional sortfunc)
"Prunes the registry-db object DB.
@ -359,7 +359,7 @@ entries first and return candidates from beginning of list."
(let* ((precious (oref db :precious))
(precious-p (lambda (entry-key)
(cdr (memq (car entry-key) precious))))
(data (oref db :data))
(data (oref db data))
(candidates (cl-loop for k being the hash-keys of data
using (hash-values v)
when (notany precious-p v)