emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 300f72f: Don't add debbugs address to message body


From: Katsumi Yamaoka
Subject: [Emacs-diffs] master 300f72f: Don't add debbugs address to message body (bug#25896)
Date: Thu, 2 Mar 2017 02:56:17 -0500 (EST)

branch: master
commit 300f72f3a36b8af2e477bc9930725a48da6b0a0d
Author: Katsumi Yamaoka <address@hidden>
Commit: Katsumi Yamaoka <address@hidden>

    Don't add debbugs address to message body (bug#25896)
    
    * lisp/gnus/gnus-group.el (gnus-read-ephemeral-bug-group):
    Don't add debbugs address to message body (bug#25896), and
    don't add it to message header either if it already exists.
---
 lisp/gnus/gnus-group.el | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 2488cdb..8a061b7 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2464,14 +2464,33 @@ the bug number, and browsing the URL must return mbox 
output."
                     (file-exists-p file))
                (insert-file-contents file)
              (url-insert-file-contents (format mbox-url id)))))
-       (goto-char (point-min))
        ;; Add the debbugs address so that we can respond to reports easily.
-       (while (re-search-forward "^To: " nil t)
-         (end-of-line)
-         (insert (format ", address@hidden" (car ids)
-                         (replace-regexp-in-string
-                          "/.*$" ""
-                          (replace-regexp-in-string "^http://"; "" 
mbox-url)))))))
+       (let ((address
+              (format "address@hidden" (car ids)
+                      (replace-regexp-in-string
+                       "/.*$" ""
+                       (replace-regexp-in-string "^http://"; "" mbox-url)))))
+         (goto-char (point-min))
+         (while (re-search-forward (concat "^" message-unix-mail-delimiter)
+                                   nil t)
+           (narrow-to-region (point)
+                             (if (search-forward "\n\n" nil t)
+                                 (1- (point))
+                               (point-max)))
+           (unless (string-match (concat "\\(?:\\`\\|[ ,<]\\)"
+                                         (regexp-quote address)
+                                         "\\(?:\\'\\|[ ,>]\\)")
+                                 (concat (message-fetch-field "to") " "
+                                         (message-fetch-field "cc")))
+             (goto-char (point-min))
+             (if (re-search-forward "^To:" nil t)
+                 (progn
+                   (message-next-header)
+                   (skip-chars-backward "\t\n ")
+                   (insert ", " address))
+               (insert "To: " address "\n")))
+           (goto-char (point-max))
+           (widen)))))
     (gnus-group-read-ephemeral-group
      (format "nndoc+ephemeral:bug#%s"
             (mapconcat 'number-to-string ids ","))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]