emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 6b605a9 06/21: Hash records against their tag fiel


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 6b605a9 06/21: Hash records against their tag field tags
Date: Sun, 17 Sep 2017 15:32:46 -0400 (EDT)

branch: externals/ebdb
commit 6b605a9e37d70161255f317028def1df2bba763e
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    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.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]