[gnus git] branch master updated: m0-7-291-g70154ae =2= Restore fancy split match data reliably ; Call `spam-initialize' automatically

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  70154aee617e9a82ad6bb3db9d400026c458ce3a (commit)
       via  1e6c7ffb15683edf6c2f300df758eec780ae923c (commit)
      from  348e94cfed4d08f36677cc562b2e700ff439d829 (commit)


- Log -----------------------------------------------------------------
commit 70154aee617e9a82ad6bb3db9d400026c458ce3a
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Jan 30 15:36:26 2014 -0800

    Restore fancy split match data reliably
    
    * nnmail.el (nnmail-split-it): Instead of redoing the search to restore
    the match data, just save and restore it explictly (bug#12375).

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6ae0a4a..366b71c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2014-01-30  Lars Ingebrigtsen  <[email protected]>
 
+	* nnmail.el (nnmail-split-it): Instead of redoing the search to restore
+	the match data, just save and restore it explictly (bug#12375).
+
 	* gnus-sum.el (gnus-summary-read-group-1): Initialize the spam code if
 	that's needed.
 
diff --git a/lisp/nnmail.el b/lisp/nnmail.el
index 2817b54..6c6025b 100644
--- a/lisp/nnmail.el
+++ b/lisp/nnmail.el
@@ -1430,12 +1430,14 @@ See the documentation for the variable `nnmail-split-fancy' for details."
      ;; Check the cache for the regexp for this split.
      ((setq cached-pair (assq split nnmail-split-cache))
       (let (split-result
+	    match-data
 	    (end-point (point-max))
 	    (value (nth 1 split)))
 	(if (symbolp value)
 	    (setq value (cdr (assq value nnmail-split-abbrev-alist))))
 	(while (and (goto-char end-point)
 		    (re-search-backward (cdr cached-pair) nil t))
+	  (setq match-data (match-data))
 	  (when nnmail-split-tracing
 	    (push split nnmail-split-trace))
 	  (let ((split-rest (cddr split))
@@ -1464,12 +1466,9 @@ See the documentation for the variable `nnmail-split-fancy' for details."
 		(setq split-rest (cddr split-rest))))
 	    (when split-rest
 	      (goto-char end)
-	      (let ((value (nth 1 split)))
-		(if (symbolp value)
-		    (setq value (cdr (assq value nnmail-split-abbrev-alist))))
-		;; Someone might want to do a \N sub on this match, so get the
-		;; correct match positions.
-		(re-search-backward value start-of-value))
+	      ;; Someone might want to do a \N sub on this match, so
+	      ;; restore the match data.
+	      (set-match-data match-data)
 	      (dolist (sp (nnmail-split-it (car split-rest)))
 		(unless (member sp split-result)
 		  (push sp split-result))))))

commit 1e6c7ffb15683edf6c2f300df758eec780ae923c
Author: Lars Ingebrigtsen <[email protected]>
Date:   Thu Jan 30 14:57:57 2014 -0800

    Call `spam-initialize' automatically
    
    * spam.el (spam-initialize): Allow calling repeatedly, but only run the
    the code once (bug#9069).
    
    * gnus-sum.el (gnus-summary-read-group-1): Initialize the spam code if
    that's needed.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 100921b..6ae0a4a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-01-30  Lars Ingebrigtsen  <[email protected]>
+
+	* gnus-sum.el (gnus-summary-read-group-1): Initialize the spam code if
+	that's needed.
+
+	* spam.el (spam-initialize): Allow calling repeatedly, but only run the
+	the code once (bug#9069).
+
 2014-01-18  Steinar Bang  <[email protected]>
 
 	* gnus-setup.el (gnus-use-sendmail): We never use sendmail for mail
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index a1c0a0a..d6c801f 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -4024,6 +4024,8 @@ If SELECT-ARTICLES, only select those articles from GROUP."
      ;; The group was successfully selected.
      (t
       (gnus-set-global-variables)
+      (when (boundp 'spam-install-hooks)
+	(spam-initialize))
       ;; Save the active value in effect when the group was entered.
       (setq gnus-newsgroup-active
 	    (gnus-copy-sequence
diff --git a/lisp/spam.el b/lisp/spam.el
index d065596..82f98c4 100644
--- a/lisp/spam.el
+++ b/lisp/spam.el
@@ -2903,6 +2903,7 @@ explicitly, and matters only if you need the extra headers
 installed through `spam-necessary-extra-headers'."
   (interactive)
 
+  (when spam-install-hooks
     (dolist (var symbols)
       (set var t))
 
@@ -2910,7 +2911,6 @@ installed through `spam-necessary-extra-headers'."
       (add-to-list 'nnmail-extra-headers header)
       (add-to-list 'gnus-extra-headers header))
 
-  (setq spam-install-hooks t)
     ;; TODO: How do we redo this every time the `spam' face is customized?
     (push '((eq mark gnus-spam-mark) . spam)
 	  gnus-summary-highlight)
@@ -2921,7 +2921,9 @@ installed through `spam-necessary-extra-headers'."
     (add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit)
     (add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare)
     (add-hook 'gnus-get-new-news-hook 'spam-setup-widening)
-  (add-hook 'gnus-summary-prepared-hook 'spam-find-spam))
+    (add-hook 'gnus-summary-prepared-hook 'spam-find-spam)
+    ;; Don't install things more than once.
+    (setq spam-install-hooks nil)))
 
 (defun spam-unload-hook ()
   "Uninstall the spam.el hooks."
@@ -2936,8 +2938,6 @@ installed through `spam-necessary-extra-headers'."
 
 (add-hook 'spam-unload-hook 'spam-unload-hook)
 
-(when spam-install-hooks
-  (spam-initialize))
 ;;}}}
 
 (provide 'spam)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |   11 +++++++++++
 lisp/gnus-sum.el |    2 ++
 lisp/nnmail.el   |   11 +++++------
 lisp/spam.el     |   42 +++++++++++++++++++++---------------------
 4 files changed, 39 insertions(+), 27 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
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.