emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA] I regret using subtree


From: Tino Calancha
Subject: Re: [ELPA] I regret using subtree
Date: Mon, 13 Mar 2017 19:01:45 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Eric Abrahamsen <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>> The patch seems OK, except it should put the Cc in the "X-Debbugs-Cc:"
>> header (so that the maintainer gets the email with the bug-number
>> rather than email before assigned a bug-number).
>
> Here's an updated version.

I)
There are files with more than 1 maintainer/author.  Just pick up the first one
may not suffice.
E.g.,
(lm-authors (find-library-name "tramp"))
=> (("Kai Gro├čjohann" . "address@hidden")
    ("Michael Albinus" . "address@hidden"))

(lm-maintainer (find-library-name "tramp"))
=> ("Kai Gro├čjohann" . "address@hidden")
;; Your patch won't send CC to Michael.
I suggest to CC all of them.  In order to do that `lm-maintainer' must
be updated.  See patches below.

II) There are files with plural versions of 'Author', 'Maintainer' headers
For instance,
lisp/net/rcirc.el
In this case `lm-maintainer' fall back in `lm-authors' so that Liu wouldn't
be in CC.

Another example,
lisp/color.el
Just 'Authors' header, no 'Maintainer' one.  There wouldn't be CC in this case.

III)
The e-mail format might confuse these tools.
E.g.
lisp/org/org-protocol.el
;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
or in
lisp/progmodes/prolog.el
;; Maintainer: Stefan Bruda <stefan(at)bruda(dot)ca>

--8<-----------------------------cut here---------------start------------->8---
>From b0a51241e4393ee62673c181c03317649e9652fe Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 13 Mar 2017 18:56:45 +0900
Subject: [PATCH 1/3] lm-maintainer: Allow return more than 1 maintainer

* lisp/emacs-lisp/lisp-mnt.el (lm-authors, lm-maintainer): Pluralize regexp.
(lm-header-multiline): Fix regexp.
(lm-maintainer): Add second argument ALL.
---
 lisp/emacs-lisp/lisp-mnt.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index fc3caf3359..c96d224679 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -118,6 +118,8 @@
 
 ;;; Variables:
 
+(eval-when-compile (require 'subr-x))
+
 (defgroup lisp-mnt nil
   "Utility functions for Emacs Lisp maintainers."
   :prefix "lm-"
@@ -285,7 +287,7 @@ lm-header-multiline
       (when res
        (setq res (list res))
        (forward-line 1)
-       (while (looking-at "^;+\\(\t\\|[\t\s]\\{2,\\}\\)\\(.+\\)")
+       (while (looking-at "^;+\\(\t+\s?+\\|[[:blank:]]\\{2,\\}\\)\\(.+\\)")
          (push (match-string-no-properties 2) res)
          (forward-line 1)))
       (nreverse res))))
@@ -383,17 +385,20 @@ lm-authors
 Each element of the list is a cons; the car is the full name,
 the cdr is an email address."
   (lm-with-file file
-    (let ((authorlist (lm-header-multiline "author")))
+    (let ((authorlist (lm-header-multiline "author[s]?")))
       (mapcar 'lm-crack-address authorlist))))
 
-(defun lm-maintainer (&optional file)
+(defun lm-maintainer (&optional file all)
   "Return the maintainer of file FILE, or current buffer if FILE is nil.
-The return value has the form (NAME . ADDRESS)."
+If optional arg ALL is non-nil, then return all maintainers.  Otherwise,
+return just the first one.  In the former case the return value has
+the form ((NAME1 . ADDRESS1) (NAME2 . ADDRESS2) ...); in the latter case,
+the return value is just (NAME1 . ADDRESS1)."
   (lm-with-file file
-    (let ((maint (lm-header "maintainer")))
-      (if maint
-         (lm-crack-address maint)
-       (car (lm-authors))))))
+    (let ((people (if-let (maint (lm-header-multiline "maintainer[s]?"))
+                      (mapcar 'lm-crack-address maint)
+                    (lm-authors))))
+      (if all people (car people)))))
 
 (defun lm-creation-date (&optional file)
   "Return the created date given in file FILE, or current buffer if FILE is 
nil."
-- 
2.11.0

>From 26be86a780cc9c5f497a6e99bd41fc81a2be8ad6 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 13 Mar 2017 18:56:45 +0900
Subject: [PATCH 2/3] * lisp/mail/emacsbug.el (report-emacs-bug): Apply Eric
 patch.

---
 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 c1aec6923f..656eeabe0f 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -123,17 +123,26 @@ 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.
   (setq topic (concat emacs-version "; " topic))
   (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)
@@ -160,6 +169,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) ;; cdr is the email address.
+      (if (eq major-mode 'message-mode)
+          (message-position-on-field "X-Debbugs-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.11.0

>From 2114a448ad145923980dbe4d09ae5feff18eb49d Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Mon, 13 Mar 2017 18:56:45 +0900
Subject: [PATCH 3/3] * lisp/mail/emacsbug.el (report-emacs-bug): Send Cc to
 all maintainers.

---
 lisp/mail/emacsbug.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 656eeabe0f..018d2ea6a7 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -142,7 +142,7 @@ report-emacs-bug
                             (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))))
+              (lm-maintainer (find-library-name package) 'all)))
         user-point message-end-point)
     (setq message-end-point
          (with-current-buffer (messages-buffer)
@@ -169,13 +169,19 @@ 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) ;; cdr is the email address.
-      (if (eq major-mode 'message-mode)
-          (message-position-on-field "X-Debbugs-Cc")
-        (mail-cc))
-      (if (car cc)
-          (insert (format "%s <%s>" (car cc) (cdr cc)))
-        (insert (format "%s" (cdr cc)))))
+    (dolist (maint cc)
+      (when (cdr maint) ;; cdr is the email address.
+        (if (eq major-mode 'message-mode)
+            (message-position-on-field "X-Debbugs-Cc")
+          (mail-cc))
+        (cond ((car maint)
+               (insert (format "%s%s <%s>"
+                               (if (looking-back ":[[:blank:]]+?" 
(point-at-bol)) "" ", ")
+                               (car maint) (cdr maint))))
+              (t
+               (insert (format "%s%s"
+                               (if (looking-back ":[[:blank:]]+?" 
(point-at-bol)) "" ", ")
+                               (cdr maint)))))))
     (rfc822-goto-eoh)
     (forward-line 1)
     ;; Move the mail signature to the proper place.
-- 
2.11.0

--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.8)
 of 2017-03-13
Repository revision: 94b59f7dd1e8611495ff0f4596dc6dec20e268af



reply via email to

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