Changes committed gnus/lisp (ChangeLog gnus-registry.el)

"Ted Zlatanov" <[email protected]>
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog 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.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1848 gnus/lisp/ChangeLog:7.1849
--- ChangeLog:7.1848	Mon May  5 03:54:03 2008
+++ ChangeLog	Mon May  5 23:36:33 2008
@@ -1,3 +1,9 @@
+2008-05-05  Teodor Zlatanov  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* mailcap.el (mailcap-replace-in-string): New compatibility alias.
Index: gnus-registry.el
diff -u gnus/lisp/gnus-registry.el:7.59 gnus/lisp/gnus-registry.el:7.60
--- gnus-registry.el:7.59	Sat Apr 26 14:54:20 2008
+++ gnus-registry.el	Mon May  5 23:36:32 2008
@@ -680,9 +680,8 @@
   (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 @@
 			  (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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.