bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#33225: [debbugs.el] Don't send control message immediately


From: Garreau, Alexandre
Subject: bug#33225: [debbugs.el] Don't send control message immediately
Date: Thu, 01 Nov 2018 15:28:54 +0100
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

On 2018-11-01 at 08:29, Noam Postavsky wrote:
> As mentioned in [1], I have a modified version of
> debbugs-gnu-send-control-message which just creates the message (or
> edits the current one) rather than sending it right away.

I believe this is the most straightforward solution to the problem of
control messages sending too fast for the newcomer user.  However, I
guess this is a feature more than a bug for most used users, and this
would have been only useful for the first time to me, when I wanted to
“test it to see how it looks” thinking of “cancelling at the last
moment”, and discovered the mail was already sent before I could even
understand what was happening (and take the time to document more myself
on what was the control message really meaning).  Sure if I saw a
message-mode buffer before, at this moment, I’d have canceled, but that
would only have been useful the first time: then it would have become
tiring, so I would have disabled it to come back the simple behavior,
and loose the benefit of the additional security-check step.

> I'm posting it here as a patch to debbugs-gnu.el.  It might make sense
> to replace the current debbugs-gnu-send-control-message, or just
> factor out the common parts, I haven't really thought much about that.
>
> [1]: http://lists.gnu.org/archive/html/help-debbugs/2018-10/msg00014.html

What I suggested later instead was asking for confirmation for certain
control messages that might uselessly garble and bloat the bug history,
while letting go more common and useful messages that might otherwise
anyway be undone without semantic overhead [2], first suggestion was
just about asking for confirmation about certain messages and not
others, so I attach the already suggested [3] patch here for better
referencing of it.  But in last message [2] I argued in favor of better
discrimination among control messages and potentially clarifying their
meaning and better linking doc.

diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 5466d6518..ea61e96bb 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -1462,6 +1462,32 @@ returned by `debbugs-gnu-bugs'."
               (number-sequence (string-to-number from) (string-to-number to)))
              result))))))))
 
+(defconst debbugs-gnu-control-messages
+  '("serious" "important" "normal" "minor" "wishlist"
+    "done" "donenotabug" "donewontfix" "doneunreproducible"
+    "unarchive" "unmerge" "reopen" "close"
+    "merge" "forcemerge"
+    "block" "unblock"
+    "owner" "noowner"
+    "forwarded" "notforwarded"
+    "invalid"
+    "reassign"
+    "retitle"
+    "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug"
+    "pending" "help" "security" "confirmed" "easy"
+    "usertag")
+  "List of control messages accepted by Debbugs.
+All are accepted and processed by `debbugs-gnu-send-control-message'
+accordingly.")
+
+(defcustom debbugs-gnu-confirm-control-messages '("owner")
+  "List of control messages asking for confirmation.
+Each message listed will make `debbugs-gnu-send-control-message'
+ask for confirmation before sending control message mail."
+  :type (cons 'set (mapcar (apply-partially #'list 'const)
+                           debbugs-gnu-control-messages))
+  :group 'debbugs-gnu)
+
 (defun debbugs-gnu-send-control-message (message &optional reverse)
   "Send a control message for the current bug report.
 You can set the severity or add a tag, or close the report.  If
@@ -1473,19 +1499,7 @@ removed instead."
   (interactive
    (list (completing-read
          "Control message: "
-         '("serious" "important" "normal" "minor" "wishlist"
-           "done" "donenotabug" "donewontfix" "doneunreproducible"
-           "unarchive" "unmerge" "reopen" "close"
-           "merge" "forcemerge"
-           "block" "unblock"
-           "owner" "noowner"
-           "forwarded" "notforwarded"
-           "invalid"
-           "reassign"
-           "retitle"
-           "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug"
-           "pending" "help" "security" "confirmed" "easy"
-           "usertag")
+         debbugs-gnu-control-messages
          nil t)
         current-prefix-arg))
   (let* ((id (or (debbugs-gnu-current-id t)
@@ -1585,11 +1599,14 @@ removed instead."
                (format "tags %d%s %s\n"
                        id (if reverse " -" "")
                        message))))
-      (funcall (or debbugs-gnu-send-mail-function send-mail-function))
-      (remhash id debbugs-cache-data)
-      (message-goto-body)
-      (message "Control message sent:\n%s"
-              (buffer-substring-no-properties (point) (1- (point-max)))))))
+      (unless (and (member message debbugs-gnu-confirm-control-messages)
+                   (not (y-or-n-p (format "Really send `%s' control message? "
+                                          message))))
+        (funcall (or debbugs-gnu-send-mail-function send-mail-function))
+        (remhash id debbugs-cache-data)
+        (message-goto-body)
+        (message "Control message sent:\n%s"
+                 (buffer-substring-no-properties (point) (1- (point-max))))))))
 
 (defvar debbugs-gnu-usertags-mode-map
   (let ((map (make-sparse-keymap)))
[2] http://lists.gnu.org/archive/html/help-debbugs/2018-11/msg00006.html
[3] http://lists.gnu.org/archive/html/help-debbugs/2018-11/msg00001.html

reply via email to

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