Subject: bug#41373: GNU ELPA: Add "reporting bugs" to individual package pages

From: Eric Abrahamsen <[email-masked]>
Date: Tue, 19 May 2020 22:30:40 -0700

Richard Stallman <[email-masked]> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> We could have report-emacs-bug ask for which package the bug is in.
> The Bug Subject argument could be one of the acceptable package names,
> including 'emacs' and whichever ELPA packages have been loaded.  The
> user could specify one of those.
>
> If the definition of a package says where to send bug reports for it,
> report-emacs-bug could send each bug to the right place.
>
> If Bug Subject argument isn't on that list, report-emacs-bug could ask,
> "Would you like to specify one of the ELPA packages that have been
> loaded?"  But you would not have to do that.  If Bug Subject is unknown,
> the message would go to bug-gnu-emacs, as now.

Several years ago I cooked up something basic like that. I've attached
the patch from that thread, which might serve as the basis for something
usable.

Eric

>From 542d7b342d0ce86933d8c6998ca7a817952b0b3f Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <[email-masked]>
Date: Thu, 21 Jul 2016 15:58:47 -0400
Subject: [PATCH] Cc package maintainers when reporting emacs bugs

* lisp/mail/emacsbug.el (report-emacs-bug): Prompt for a package to
  report a bug against, and cc the package maintainer, if any, on the
  bug report.
---
 lisp/mail/emacsbug.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 18eaa22..87ac234 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -144,11 +144,17 @@ message-send-mail-function
 (defvar message-sendmail-envelope-from)

 ;;;###autoload
-(defun report-emacs-bug (topic &optional unused)
+(defun report-emacs-bug (topic package &optional unused)
   "Report a bug in GNU Emacs.
 Prompts for bug subject.  Leaves you in a mail buffer."
   (declare (advertised-calling-convention (topic) "24.5"))
-  (interactive "sBug Subject: ")
+  (interactive (list
+                (read-string "Bug Subject: ")
+                (completing-read
+                 "Package: "
+                 (progn
+                   (package-initialize)
+                   package-alist))))
   ;; The syntax `version;' is preferred to `[version]' because the
   ;; latter could be mistakenly stripped by mailing software.
   (if (eq system-type 'ms-dos)
@@ -158,6 +164,9 @@ report-emacs-bug
   (let ((from-buffer (current-buffer))
 	(can-insert-mail (or (report-emacs-bug-can-use-xdg-email)
 			     (report-emacs-bug-can-use-osx-open)))
+        (cc (unless (or (string-empty-p package) (string= package "emacs"))
+              (require 'finder)
+              (lm-maintainer (find-library-name package))))
         user-point message-end-point)
     (setq message-end-point
 	  (with-current-buffer (messages-buffer)
@@ -184,6 +193,13 @@ report-emacs-bug
       (when (and (not message-sendmail-envelope-from)
 		 (message-bogus-recipient-p (message-make-address)))
 	(set (make-local-variable 'message-sendmail-envelope-from) 'header)))
+    (when (cdr cc) ;; The cdr is the email address.
+      (if (derived-mode-p 'message-mode)
+          (message-goto-cc)
+        (mail-cc))
+      (if (car cc)
+          (insert (format "%s <%s>" (car cc) (cdr cc)))
+        (insert (format "%s" (cdr cc)))))
     (rfc822-goto-eoh)
     (forward-line 1)
     ;; Move the mail signature to the proper place.
--
2.9.0