branch: externals/ebdb
commit 6b605a9e37d70161255f317028def1df2bba763e
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Hash records against their tag field tags
* ebdb.el (ebdb-init-field, ebdb-delete-field): The idea is that tags
should be usable for quick hashtable lookups.
---
ebdb.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 3e4f42b..920ca5c 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2340,10 +2340,15 @@ See `ebdb-url-valid-schemes' for a list of acceptable
schemes."
(seq-find (lambda (tg) (string-match-p tag tg))
(slot-value field 'tags)))
-(cl-defmethod ebdb-init-field ((field ebdb-field-tags) _record)
+(cl-defmethod ebdb-init-field ((field ebdb-field-tags) record)
(let ((tags (slot-value field 'tags)))
(dolist (tag tags)
- (add-to-list 'ebdb-tags tag))))
+ (add-to-list 'ebdb-tags tag)
+ (ebdb-puthash tag record))))
+
+(cl-defmethod ebdb-delete-field ((field ebdb-field-tags) &optional record
_unload)
+ (dolist (tag (slot-value field 'tags))
+ (ebdb-remhash tag record)))
;;; Fields that change EBDB's behavior.