]> git.eshelyaron.com Git - emacs.git/commitdiff
Have 'submit-emacs-patch' insert maintainers into X-Debbugs-Cc
authorPhilip Kaludercic <philipk@posteo.net>
Fri, 8 Mar 2024 15:32:00 +0000 (16:32 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Feb 2025 08:06:11 +0000 (09:06 +0100)
* lisp/mail/emacsbug.el (submit-emacs-patch): Go through all files
mentioned in the diff and check for maintainers.
(submit-emacs-patch-excluded-maintainers): Add constant.  (Bug#69646)

(cherry picked from commit 4411d0de1d5cbf308440982084ad7e15a18efaf2)

lisp/mail/emacsbug.el

index d8c17e86a392bcd9428099633224d48a1e1dd4c2..f1fa33925713721d39ed56d63be6189345578665 100644 (file)
@@ -36,6 +36,7 @@
 
 (require 'sendmail)
 (require 'message)
+(require 'lisp-mnt)
 
 (defgroup emacsbug nil
   "Sending Emacs bug reports."
@@ -497,6 +498,10 @@ and send the mail again%s."
     (when (get-buffer-window help)
       (quit-window nil (get-buffer-window help)))))
 
+(defconst submit-emacs-patch-excluded-maintainers
+  '("emacs-devel@gnu.org")
+  "List of maintainer addresses for `submit-emacs-patch' to ignore.")
+
 ;;;###autoload
 (defun submit-emacs-patch (subject file)
   "Send an Emacs patch to the Emacs maintainers.
@@ -533,7 +538,33 @@ Message buffer where you can explain more about the patch."
     (button-mode 1))
   (compose-mail-other-window report-emacs-bug-address subject)
   (rfc822-goto-eoh)
-  (insert "X-Debbugs-Cc: \n")
+  (insert "X-Debbugs-Cc: ")
+  (let ((maint (let (files)
+                 (with-temp-buffer
+                   (insert-file-contents file)
+                   (while (search-forward-regexp "^\\+\\{3\\} ./\\(.*\\)" nil t)
+                     (push (expand-file-name
+                            (match-string-no-properties 1)
+                            source-directory)
+                           files)))
+                 (mapcan
+                  (lambda (patch)
+                    (seq-remove
+                     (pcase-lambda (`(,_name . ,addr))
+                       (member addr submit-emacs-patch-excluded-maintainers))
+                     ;; TODO: Consult admin/MAINTAINERS for additional
+                     ;; information.  This either requires some
+                     ;; heuristics to parse the existing file or to
+                     ;; adjust the file format to make it more machine
+                     ;; readable (bug#69646).
+                     (lm-maintainers patch)))
+                  files))))
+    (when maint
+      (insert (mapconcat
+               (pcase-lambda (`(,name . ,addr))
+                 (format "%s <%s>" name addr))
+               maint ", "))))
+  (insert "\n")
   (message-goto-body)
   (insert "\n\n\n")
   (emacs-build-description)