[gnus git] branch master updated: m0-5-118-g7eb8188 =5= Make the `C-c C-n' command in Message more sturdy ; Indent. ; Indent. ; Indent. ; * gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in sieve rules (bug#11688).

Lars Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  7eb81887beaae1e8a345a0294b0fddbaf2b20a5e (commit)
       via  ca86f8a7df2ba1576a8267a282a3f135913312e1 (commit)
       via  2928e3c938f6f439119308b5b3f6a78acb58978e (commit)
       via  86823acedaad0115af87e7ce7446221449290886 (commit)
       via  f21bb30de5dbaf1d29ad9ad742fed5614ec1ecde (commit)
      from  b8786cba04cf263048ad456168d141f94e5fa92a (commit)


- Log -----------------------------------------------------------------
commit 7eb81887beaae1e8a345a0294b0fddbaf2b20a5e
Author: Lars Ingebrigtsen <[email protected]>
Date:   Wed Sep 5 19:47:27 2012 +0200

    Make the `C-c C-n' command in Message more sturdy
    
    * message.el (message-insert-newsgroups): Don't insert newsgroup
    duplicates (bug#12275).

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5379383..b5b7063 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-05  Lars Ingebrigtsen  <[email protected]>
+
+	* message.el (message-insert-newsgroups): Don't insert newsgroup
+	duplicates (bug#12275).
+
 2012-09-05  John Wiegley  <[email protected]>
 
 	* gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in
diff --git a/lisp/message.el b/lisp/message.el
index 1fea5f9..12002b6 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -3336,11 +3336,33 @@ or in the synonym headers, defined by `message-header-synonyms'."
 (defun message-insert-newsgroups ()
   "Insert the Newsgroups header from the article being replied to."
   (interactive)
-  (when (and (message-position-on-field "Newsgroups")
-	     (mail-fetch-field "newsgroups")
-	     (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups"))))
+  (let ((old-newsgroups (mail-fetch-field "newsgroups"))
+	(new-newsgroups (message-fetch-reply-field "newsgroups"))
+	(first t)
+	insert-newsgroups)
+    (message-position-on-field "Newsgroups")
+    (cond
+     ((not new-newsgroups)
+      (error "No Newsgroups to insert"))
+     ((not old-newsgroups)
+      (insert new-newsgroups))
+     (t
+      (setq new-newsgroups (split-string new-newsgroups "[, ]+")
+	    old-newsgroups (split-string old-newsgroups "[, ]+"))
+      (dolist (group new-newsgroups)
+	(unless (member group old-newsgroups)
+	  (push group insert-newsgroups)))
+      (if (null insert-newsgroups)
+	  (error "Newgroup%s already in the header"
+		 (if (> (length new-newsgroups) 1)
+		     "s" ""))
+	(when old-newsgroups
+	  (setq first nil))
+	(dolist (group insert-newsgroups)
+	  (unless first
     (insert ","))
-  (insert (or (message-fetch-reply-field "newsgroups") "")))
+	  (setq first nil)
+	  (insert group)))))))
 
 
 

commit ca86f8a7df2ba1576a8267a282a3f135913312e1
Author: Lars Ingebrigtsen <[email protected]>
Date:   Wed Sep 5 19:47:02 2012 +0200

    Indent.

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 8059d80..9f638a7 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -1727,8 +1727,7 @@ to reconnect, unless NO-RECONNECT is set to t.  Return nil if
 unsuccessful in connecting.
 If GROUP is nil, return t.
 If READ-ONLY is set, send EXAMINE rather than SELECT to the server.
-Return the server's response to the SELECT or EXAMINE command.
-"
+Return the server's response to the SELECT or EXAMINE command."
   (let ((open-result t))
     (when (and server
 	       (not (nnimap-server-opened server)))

commit 2928e3c938f6f439119308b5b3f6a78acb58978e
Author: Lars Ingebrigtsen <[email protected]>
Date:   Wed Sep 5 19:30:04 2012 +0200

    Indent.

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 73ce709..8059d80 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -980,7 +980,8 @@ textual parts.")
 			       (cdr (assoc "SEARCH" (cdr result))))))))))
 
 
-(defun nnimap-find-article-by-message-id (group server message-id &optional limit)
+(defun nnimap-find-article-by-message-id (group server message-id
+						&optional limit)
   "Search for message with MESSAGE-ID in GROUP from SERVER.
 If LIMIT, first try to limit the search to the N last articles."
   (with-current-buffer (nnimap-buffer)

commit 86823acedaad0115af87e7ce7446221449290886
Author: Lars Ingebrigtsen <[email protected]>
Date:   Wed Sep 5 19:29:50 2012 +0200

    Indent.

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index be5501b..73ce709 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -993,16 +993,19 @@ If LIMIT, first try to limit the search to the N last articles."
                      (when (equal "EXISTS" (cadr result))
                        (throw 'found (car result)))))))
            (sequence
-            (nnimap-send-command "UID SEARCH%s HEADER Message-Id %S"
+            (nnimap-send-command
+	     "UID SEARCH%s HEADER Message-Id %S"
                                  (if (and limit number-of-article)
                                      ;; The -1 is because IMAP message
                                      ;; numbers are one-based rather than
                                      ;; zero-based.
-                                     (format " %s:*" (- (string-to-number number-of-article) limit -1))
+		 (format " %s:*" (- (string-to-number number-of-article)
+				    limit -1))
                                    "")
                                  message-id)))
       (when (nnimap-wait-for-response sequence)
-        (let ((article (car (last (cdr (assoc "SEARCH" (nnimap-parse-response)))))))
+        (let ((article (car (last (cdr (assoc "SEARCH"
+					      (nnimap-parse-response)))))))
           (if article
               (string-to-number article)
             (when (and limit number-of-article)

commit f21bb30de5dbaf1d29ad9ad742fed5614ec1ecde
Author: John Wiegley <[email protected]>
Date:   Wed Sep 5 19:26:03 2012 +0200

    * gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in
    sieve rules (bug#11688).

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9ede5cf..5379383 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,12 @@
+2012-09-05  John Wiegley  <[email protected]>
+
+	* gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in
+	sieve rules.
+
 2012-09-05  Jan Tatarik  <[email protected]>
 
-	* gnus-score.el (gnus-score-decode-text-parts): Use #' for the local function.
+	* gnus-score.el (gnus-score-decode-text-parts): Use #' for the local
+	function.
 
 	* gnus-logic.el (gnus-advanced-body): Allow scoring on decoded bodies.
 
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 84814b6..617ccf4 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -3825,12 +3825,28 @@ You should probably use `gnus-find-method-for-group' instead."
   "Go through PARAMETERS and expand them according to the match data."
   (let (new)
     (dolist (elem parameters)
-      (if (and (stringp (cdr elem))
+      (cond
+       ((and (stringp (cdr elem))
 	       (string-match "\\\\[0-9&]" (cdr elem)))
 	  (push (cons (car elem)
 		      (gnus-expand-group-parameter match (cdr elem) group))
-		new)
-	(push elem new)))
+              new))
+       ;; For `sieve' group parameters, perform substitutions for every
+       ;; string within the match rule.  This allows for parameters such
+       ;; as:
+       ;;  ("list\\.\\(.*\\)"
+       ;;   (sieve header :is "list-id" "<\\1.domain.org>"))
+       ((eq 'sieve (car elem))
+        (push (mapcar (lambda (sieve-elem)
+                        (if (and (stringp sieve-elem)
+                                 (string-match "\\\\[0-9&]" sieve-elem))
+                            (gnus-expand-group-parameter match sieve-elem
+                                                         group)
+                          sieve-elem))
+                      (cdr elem))
+              new))
+       (t
+	(push elem new))))
     new))
 
 (defun gnus-group-fast-parameter (group symbol &optional allow-list)
@@ -3862,9 +3878,20 @@ The function `gnus-group-find-parameter' will do that for you."
 	      (when this-result
 		(setq result (car this-result))
 		;; Expand if necessary.
-		(if (and (stringp result) (string-match "\\\\[0-9&]" result))
+		(cond
+                 ((and (stringp result) (string-match "\\\\[0-9&]" result))
 		    (setq result (gnus-expand-group-parameter
-				  (car head) result group)))))))
+                                (car head) result group)))
+                 ;; For `sieve' group parameters, perform substitutions
+                 ;; for every string within the match rule (see above).
+                 ((eq symbol 'sieve)
+                  (setq result
+                        (mapcar (lambda (elem)
+                                  (if (stringp elem)
+                                      (gnus-expand-group-parameter (car head)
+                                                                   elem group)
+                                    elem))
+                                result))))))))
 	;; Done.
 	result))))
 

-----------------------------------------------------------------------
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  |   13 ++++++++++++-
 lisp/gnus.el    |   45 ++++++++++++++++++++++++++++++++++++---------
 lisp/message.el |   32 +++++++++++++++++++++++++++-----
 lisp/nnimap.el  |   27 +++++++++++++++------------
 4 files changed, 90 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.