Merge from gnus--devo--0
authorMiles Bader <miles@gnu.org>
Thu, 8 May 2008 09:59:46 +0000 (09:59 +0000)
committerMiles Bader <miles@gnu.org>
Thu, 8 May 2008 09:59:46 +0000 (09:59 +0000)
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1149

lisp/gnus/ChangeLog
lisp/gnus/gnus-registry.el
lisp/gnus/gnus-util.el

index 4fef082..4f70aab 100644 (file)
@@ -3,6 +3,24 @@
        * gnus-art.el (gnus-article-toggle-truncate-lines):
        Don't use `iff' in docstring.
 
+2008-05-07  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-registry.el: Adjusted copyright dates and added a keyword.
+
+       * gnus-util.el (gnus-extract-address-component-name)
+       (gnus-extract-address-component-email): Convenience functions around
+       `gnus-extract-address-components'.
+
+       * gnus-registry.el (gnus-registry-split-fancy-with-parent): Use
+       `gnus-extract-address-component-email' to fix bug of comparing full
+       sender name to `user-mail-address'.
+
+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-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * gnus-srvr.el (gnus-enter-server-buffer): Make sure the server-buffer
index 349f29a..18163fe 100644 (file)
@@ -1,10 +1,10 @@
 ;;; gnus-registry.el --- article registry for Gnus
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 
+;;; Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
-;; Keywords: news
+;; Keywords: news registry
 
 ;; This file is part of GNU Emacs.
 
@@ -523,7 +523,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
      ;; else: there were no matches, now try the extra tracking by sender
      ((and (gnus-registry-track-sender-p)
           sender
-          (not (equal sender user-mail-address)))
+          (not (equal (gnus-extract-address-component-email sender)
+                      user-mail-address)))
       (maphash
        (lambda (key value)
         (let ((this-sender (cdr
@@ -678,9 +679,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))
@@ -730,15 +730,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.
index 21fda61..a327522 100644 (file)
@@ -193,6 +193,15 @@ is slower."
                                   (match-end 0)))))
     (list (if (string= name "") nil name) (or address from))))
 
+(defun gnus-extract-address-component-name (from)
+  "Extract name from a From header.
+Uses `gnus-extract-address-components'."
+  (nth 0 (gnus-extract-address-components from)))
+
+(defun gnus-extract-address-component-email (from)
+  "Extract e-mail address from a From header.
+Uses `gnus-extract-address-components'."
+  (nth 1 (gnus-extract-address-components from)))
 
 (defun gnus-fetch-field (field)
   "Return the value of the header FIELD of current article."