(gnus-registry-grep-in-list): Fix logic, use
authorTeodor Zlatanov <tzz@lifelogs.com>
Mon, 5 May 2008 21:36:33 +0000 (21:36 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Mon, 5 May 2008 21:36:33 +0000 (21:36 +0000)
catch/throw to optimize.
(gnus-registry-find-keywords): Just use member to find a keyword.

lisp/ChangeLog
lisp/gnus-registry.el

index 688024c..de395ef 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-05  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-registry.el (gnus-registry-grep-in-list): Fix logic, use
+       catch/throw to optimize.
+       (gnus-registry-find-keywords): Just use member to find a keyword.
+
 2008-05-04  Juri Linkov  <juri@jurta.org>
 
        * mailcap.el (mailcap-replace-in-string): New compatibility alias.
index 281c29c..cec3ffd 100644 (file)
@@ -680,9 +680,8 @@ Consults `gnus-registry-unfollowed-groups' and
   (let (articles)
     (maphash
      (lambda (key value)
-       (when (gnus-registry-grep-in-list
-             keyword
-             (cdr (gnus-registry-fetch-extra key 'keywords)))
+       (when (member keyword
+                  (cdr-safe (gnus-registry-fetch-extra key 'keywords)))
         (push key articles)))
      gnus-registry-hashtb)
     articles))
@@ -732,15 +731,13 @@ Consults `gnus-registry-unfollowed-groups' and
                          (assoc article (gnus-data-list nil)))))
     nil))
 
-;;; this should be redone with catch/throw
 (defun gnus-registry-grep-in-list (word list)
-  (when word
-    (memq nil
-         (mapcar 'not
-                 (mapcar
-                  (lambda (x)
-                    (string-match word x))
-                  list)))))
+"Find if a WORD matches any regular expression in the given LIST."
+  (when (and word list)
+    (catch 'found
+      (dolist (r list)
+       (when (string-match r word)
+         (throw 'found r))))))
 
 (defun gnus-registry-do-marks (type function)
   "For each known mark, call FUNCTION for each cell of type TYPE.