From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#33225: [debbugs.el] Don't send control message immediately Date: Sun, 31 Mar 2019 17:27:27 -0400 Message-ID: <87lg0uivk0.fsf@gmail.com> References: <87k1lxhtfc.fsf@gmail.com> <87efc3lqwo.fsf@gmx.de> <87y34x84km.fsf@gmail.com> <877ecfqr86.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="138617"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.91 (gnu/linux) Cc: 33225@debbugs.gnu.org, "garreau, alexandre" To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 31 23:28:20 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAi04-000Zw4-9p for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 23:28:20 +0200 Original-Received: from localhost ([127.0.0.1]:42933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAi03-0007LO-70 for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 17:28:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAhzo-0007LB-UQ for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 17:28:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAhzm-0002gj-Bi for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 17:28:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAhzl-0002gQ-TW for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 17:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAhzl-000581-PV for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2019 17:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2019 21:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33225 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 33225-submit@debbugs.gnu.org id=B33225.155406765919684 (code B ref 33225); Sun, 31 Mar 2019 21:28:01 +0000 Original-Received: (at 33225) by debbugs.gnu.org; 31 Mar 2019 21:27:39 +0000 Original-Received: from localhost ([127.0.0.1]:38547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAhzO-00057Q-BH for submit@debbugs.gnu.org; Sun, 31 Mar 2019 17:27:39 -0400 Original-Received: from mail-qk1-f180.google.com ([209.85.222.180]:33653) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAhzL-00057B-JA for 33225@debbugs.gnu.org; Sun, 31 Mar 2019 17:27:36 -0400 Original-Received: by mail-qk1-f180.google.com with SMTP id k189so4483094qkc.0 for <33225@debbugs.gnu.org>; Sun, 31 Mar 2019 14:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=QFVF/LRXcNg4QhL/7MCYOo4EdL61+uhpyRdvdWg0vB0=; b=bh1fHVgOZTI61g4yWxQwgtHvdfyN28ZKDb5Mv/8IOBkle5RFO+6onVqeynIZ4PLcbw PZvgdPXvKQxgLKcgxKXEkvfKuszV4bcRXABx0e9TxDdJo3dBi9YtryTKx4Rk0/sLrt6Z q17yfDQ/Qvvkwj4etW789IJGjPRxbThfcHYViPHDZ7YAS8oN5rw8PpIa/y1kEXY3GTnZ BElCRDIRbx4wNpdUlRjYFPHGPbad9c5TZbD9MJUwsk4EMSZxPInMAWzguB6pa3BA7E4q TrzYxu/A/pFlXHKhdB8K1x56DTahz0nI3vgSJ8HYxm21h5NBXXCEGfYdQVA0iDhNV6v4 ThGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=QFVF/LRXcNg4QhL/7MCYOo4EdL61+uhpyRdvdWg0vB0=; b=SYWlQ4kE8mIrdt7ZGQV8Awj9KhuaLiKrp19YObu5dMcOy46qnV/UxuMvKzzn3sW7kk LXEPxN/da9Ex5UFhU4XpLgoZlNGRGV3/JztEDzs+beJpbNQlpgpY+ndiJ9SPfrCCljh8 MGpqcRFxQ1712OHAPwNcsdKfs6CpfHVohts9xYRg6rLqRpULNdXpj5LtpxQCavakJaKF UW3pl/bB54fDX8qLz9HFc/0ES1O93iSrPTBvHLTrWdk9UrZGLIVuo3C0lMh//FeyA+pL 0ujyTA7se/fUOdTCinDajm7vwuWLLYTcrjXyvD8tlZOMzK4E+mogcyqy0XqclN57VY7Y 720g== X-Gm-Message-State: APjAAAVzVFjyVg+xuRDeC5F4sgTl4/X5CXvEotqI9QPGcXQTI1hbSrbW 60l3iHOoi7v3LrOoYwZUVp0= X-Google-Smtp-Source: APXvYqxI29vf/+dbxayIRIUmgPLVR6xTgXVzIDjhHMsw7mf2XHUnN2gjGIobgYx5F5kOhE8JqHbgSA== X-Received: by 2002:ae9:e8c3:: with SMTP id a186mr42155078qkg.183.1554067649930; Sun, 31 Mar 2019 14:27:29 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id o136sm4590941qke.48.2019.03.31.14.27.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 14:27:28 -0700 (PDT) In-Reply-To: <877ecfqr86.fsf@gmx.de> (Michael Albinus's message of "Sun, 31 Mar 2019 12:21:29 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156990 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Michael Albinus writes: > Thanks for the patch. In general, it works fine, so I guess you could > push it. We (I)'ll play then for some days, and if there's no serious > complaint, I'll make a new debbugs release. > > But I still have some comments :-) I've updated according to your comments, I'll wait another couple of days before pushing in case we can catch any more silly mistakes. Regarding making a release, I have in mind next to bring in my commands which produce control messages from git commits (both for attaching proposed patches from an unpushed commit, and closing from a pushed one). Perhaps you want to wait for that before making a new release? (or perhaps just the opposite, not sure what your release policy is) > Please rename > > debbugs-control-make-message =E2=86=92 debbugs-gnu-make-control-message > debbugs-control-message-keywords =E2=86=92 debbugs-gnu-control-message-ke= ywords > debbugs-control-message-commands-regexp =E2=86=92 debbugs-gnu-control-mes= sage-commands-regexp > debbugs-control-message-end-regexp =E2=86=92 debbugs-gnu-control-message-= end-regexp > > Please add (the keybindings of) debbugs-gnu-make-control-message to the > Commentary sections of debbugs-gnu.el and debbugs-org.el and to the nodes > "Tabulated Lists" and "TODO Items" of debbugs-ug.texi. Done and done. > Compiling debbugs-gnu.el results in > > debbugs-gnu.el:1534:1:Warning: Unused lexical variable =E2=80=98addr=E2= =80=99 > debbugs-gnu.el:1552:1:Warning: Unused lexical variable =E2=80=98micro=E2= =80=99 > debbugs-gnu.el:1552:1:Warning: Unused lexical variable =E2=80=98subject= =E2=80=99 > > Maybe you can fix it? Oops, yes. >> +(defconst debbugs-control-message-keywords >> + "usertag" "user" >> + "documentation" ;; usertag:emacs.documentation >> + )) > > I suppose "user" is needed in case of debbugs-gnu-make-control-message > only. Could we separate this, and offer completion only for that > function? Actually, thinking about it, there's really no need for a "user" control message. I've just removed it instead (it only needs to go in debbugs-gnu-control-message-commands-regexp). >> + ((member message '("merge" "forcemerge")) >> + (format "%s %d %s\n" message bugid >> + (read-string "Merge with bug #: "))) > > You have removed the bug number completion via > debbugs-gnu-expand-bug-number-list. Why? >> + ((member message '("block" "unblock")) > dito Ah, I think what happened is that I started from a very old version debbugs-gnu-send-control-message which didn't use debbugs-gnu-expand-bug-number-list. Fixed now (I also added back the version arg to "close"). >> +@item user >> +"user @var{username}" >> + >> +The username, read interactively, is either a package name or an email >> +address. > > Please mention, that this is used in order to avoid giving the user name > again, for further commands. As mentioned above, I decided to simply remove this instead. And I also removed the duplicate avoidance feature of "documentation". Making the message shorter isn't that much of a benefit, and having it adds more possible failure modes (e.g., if there is both "user emacs" and "user something-else", things get tricky). --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v3-0001-New-command-debbugs-control-make-message-Bug-3322.patch Content-Description: patch >From 80080854cd4e9d34fcd6e397b402ce5230deb310 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 1 Nov 2018 08:03:57 -0400 Subject: [PATCH v3] New command debbugs-control-make-message (Bug#33225) Add new command debbugs-control-make-message which is like debbugs-gnu-send-control-message, but doesn't send the message immediately. * packages/debbugs/debbugs-ug.texi: Document additional keybinding and control message keywords: "found", "notfound", "notfixed", and "documentation". * packages/debbugs/debbugs-gnu.el (debbugs-control-message-keywords): (debbugs-gnu-control-message-commands-regexp) (debbugs-gnu-control-message-end-regexp): New constants. (debbugs-gnus-implicit-ids): New function. (debbugs-gnu-make-control-message): New command. (debbugs-gnu-send-control-message): Move guts to new command. (debbugs-gnu-mode-map, debbugs-read-emacs-bug-with-rmail) (debbugs-gnu-summary-mode-map) * packages/debbugs/debbugs-org.el (debbugs-org-mode-map): Bind debbugs-gnu-make-control-message to "E". --- packages/debbugs/debbugs-gnu.el | 333 ++++++++++++++++++++++++++------------- packages/debbugs/debbugs-org.el | 2 + packages/debbugs/debbugs-ug.texi | 27 ++++ 3 files changed, 249 insertions(+), 113 deletions(-) diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index aa584b248..effb6acaf 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -91,6 +91,7 @@ ;; RET: Show corresponding messages in Gnus/Rmail ;; "C": Send a control message +;; "E": Make (but don't yet send) a control message ;; "t": Mark the bug locally as tagged ;; "b": Show bugs this bug is blocked by ;; "B": Show bugs this bug is blocking @@ -107,7 +108,8 @@ ;; "w": Display all the currently selected bug reports ;; When you visit the related bug messages in Gnus or Rmail, you could -;; also send control messages by keystroke "C". +;; also send or make control messages by keystroke "C" or "E" in the +;; message summary buffer. ;; In the header line of every bug list page, you can toggle sorting ;; per column by selecting a column with the mouse. The sorting @@ -917,6 +919,7 @@ (defvar debbugs-gnu-mode-map (define-key map "g" 'debbugs-gnu-rescan) (define-key map "R" 'debbugs-gnu-show-all-blocking-reports) (define-key map "C" 'debbugs-gnu-send-control-message) + (define-key map "E" 'debbugs-gnu-make-control-message) (define-key map "s" 'debbugs-gnu-toggle-sort) (define-key map "t" 'debbugs-gnu-toggle-tag) @@ -1324,9 +1327,11 @@ (defun debbugs-read-emacs-bug-with-rmail (id status merged) (format "Re: bug#%d: %s" id (cdr (assq 'subject status)))) (rmail-summary) (define-key rmail-summary-mode-map "C" 'debbugs-gnu-send-control-message) + (define-key rmail-summary-mode-map "E" 'debbugs-gnu-make-control-message) (set-window-text-height nil 10) (other-window 1) (define-key rmail-mode-map "C" 'debbugs-gnu-send-control-message) + (define-key rmail-mode-map "E" 'debbugs-gnu-make-control-message) (rmail-show-message 1))) (defcustom debbugs-gnu-lars-workflow nil @@ -1375,6 +1380,7 @@ (defun debbugs-gnu-select-report () (defvar debbugs-gnu-summary-mode-map (let ((map (make-sparse-keymap))) (define-key map "C" 'debbugs-gnu-send-control-message) + (define-key map "E" 'debbugs-gnu-make-control-message) (define-key map [(meta m)] 'debbugs-gnu-apply-patch) map)) @@ -1472,6 +1478,37 @@ (defun debbugs-gnu-expand-bug-number-list (bug-number-list) (number-sequence (string-to-number from) (string-to-number to))) result)))))))) + +(defconst debbugs-gnu-control-message-keywords + '("serious" "important" "normal" "minor" "wishlist" + "done" "donenotabug" "donewontfix" "doneunreproducible" + "invalid" ; done+notabug+wontfix + "unarchive" "unmerge" "reopen" "close" + "merge" "forcemerge" + "block" "unblock" + "owner" "noowner" + "reassign" + "retitle" + "forwarded" "notforwarded" + ;; 'notfixed ' works, even though it's + ;; undocumented at debbugs.gnu.org. + "fixed" "found" "notfound" "notfixed" + "patch" "wontfix" "moreinfo" "unreproducible" "notabug" + "pending" "help" "security" "confirmed" "easy" + "usertag" + "documentation" ;; usertag:emacs.documentation + )) + +(defconst debbugs-gnu-control-message-commands-regexp + (concat "^" (regexp-opt (cl-list* "#" "tags" "severity" "user" + debbugs-gnu-control-message-keywords)) + " .*$")) + +(defconst debbugs-gnu-control-message-end-regexp + (concat "^" (regexp-opt '("--" "quit" "stop" + "thank" "thanks" "thankyou" "thank you")) + "$")) + (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 @@ -1482,124 +1519,194 @@ (defun debbugs-gnu-send-control-message (message &optional reverse) 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") - nil t) + "Control message: " debbugs-gnu-control-message-keywords nil t) current-prefix-arg)) - (let* ((id (or (debbugs-gnu-current-id t) - debbugs-gnu-bug-number ; Set on group entry. - (debbugs-gnu-guess-current-id))) - (status (debbugs-gnu-current-status)) - (version - (when (and - (member message '("close" "done")) - (member "emacs" (cdr (assq 'package status)))) - (read-string - "Version: " - (cond - ;; Emacs development versions. - ((if (boundp 'emacs-build-number) - (string-match - "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version) - (string-match - "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\." emacs-version)) - (format "%s.%d" - (match-string 1 emacs-version) - (1+ (string-to-number (match-string 2 emacs-version))))) - ;; Emacs release versions. - ((if (boundp 'emacs-build-number) - (string-match - "^\\([0-9]+\\)\\.\\([0-9]+\\)$" emacs-version) - (string-match - "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" emacs-version)) - (format "%s.%s" - (match-string 1 emacs-version) - (match-string 2 emacs-version))) - (t emacs-version)))))) + (let ((id (or (debbugs-gnu-current-id t) + debbugs-gnu-bug-number ; Set on group entry. + (debbugs-gnu-guess-current-id)))) (with-temp-buffer - (insert "To: control@debbugs.gnu.org\n" - "From: " (message-make-from) "\n" - (format "Subject: control message for bug #%d\n" id) - mail-header-separator - "\n" - (cond - ((member message '("unarchive" "unmerge" "reopen" - "noowner" "notforwarded")) - (format "%s %d\n" message id)) - ((member message '("merge" "forcemerge")) - (format - "%s %d %s\n" message id - (mapconcat - 'identity - (debbugs-gnu-expand-bug-number-list - (completing-read-multiple - (format "%s with bug(s) #: " (capitalize message)) - debbugs-gnu-completion-table)) - " "))) - ((member message '("block" "unblock")) - (format - "%s %d by %s\n" message id - (mapconcat - 'identity - (debbugs-gnu-expand-bug-number-list - (completing-read-multiple - (format "%s with bug(s) #: " (capitalize message)) - (if (equal message "unblock") - (mapcar 'number-to-string - (cdr (assq 'blockedby status))) - debbugs-gnu-completion-table) - nil (and (equal message "unblock") status))) - " "))) - ((equal message "owner") - (format "owner %d !\n" id)) - ((equal message "retitle") - (format "retitle %d %s\n" id (read-string "New title: "))) - ((equal message "reassign") - (format "reassign %d %s\n" id (read-string "Package(s): "))) - ((equal message "forwarded") - (format "forwarded %d %s\n" id (read-string "Forwarded to: "))) - ((equal message "close") - (format "close %d %s\n" id (or version ""))) - ((equal message "done") - (format "tags %d fixed\nclose %d %s\n" id id (or version ""))) - ((member message '("donenotabug" "donewontfix" - "doneunreproducible")) - (format "tags %d %s\nclose %d\n" id (substring message 4) id)) - ((member message '("serious" "important" "normal" - "minor" "wishlist")) - (format "severity %d %s\n" id message)) - ((equal message "invalid") - (format "tags %d notabug\ntags %d wontfix\nclose %d\n" - id id id)) - ((equal message "usertag") - (format "user %s\nusertag %d %s\n" - (completing-read - "Package name or email address: " - (append - debbugs-gnu-all-packages (list user-mail-address)) - nil nil (car debbugs-gnu-default-packages)) - id (read-string "User tag: "))) - (t - (format "tags %d%s %s\n" - id (if reverse " -" "") - message)))) + (debbugs-gnu-make-control-message + message id reverse (current-buffer)) (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))))))) + (buffer-substring-no-properties (point) (1- (point-max))))))) + +(defun debbugs-gnus-implicit-ids () + "Return a list of bug IDs guessed from the current buffer." + (delq nil (delete-dups + (list (debbugs-gnu-current-id t) + debbugs-gnu-bug-number ; Set on group entry. + (debbugs-gnu-guess-current-id) + (let ((bugnum-re "\\([0-9]+\\)\\(?:-done\\)?@debbugs.gnu.org")) + (when (derived-mode-p 'message-mode) + (save-excursion + (save-restriction + (message-narrow-to-headers) + (or (let ((addr (message-fetch-field "to"))) + (and addr (string-match bugnum-re addr) + (string-to-number (match-string 1 addr)))) + (let ((addr (message-fetch-field "cc"))) + (and addr (string-match bugnum-re addr) + (string-to-number (match-string 1 addr))))))))))))) + +(defun debbugs-gnu-make-control-message (message bugid &optional reverse buffer) + "Make a control message for the current bug report. +The message is inserted into BUFFER, and mail headers are adjust +so that it will be sent to control@debbugs.gnu.org (via Bcc if +there is already a To address). If BUFFER omitted, create and +display a new buffer. + +When called interactively, choose the current buffer if it is in +`message-mode', or create a new buffer otherwise. + +You can set the severity or add a tag, or close the report. If +you use the special \"done\" MESSAGE, the report will be marked as +fixed, and then closed. + +If given a prefix, and given a tag to set, the tag will be +removed instead." + (interactive + (save-excursion ; Point can change while prompting! + (list (completing-read + "Control message: " debbugs-gnu-control-message-keywords nil t) + (let* ((implicit-ids (mapcar #'prin1-to-string + (debbugs-gnus-implicit-ids))) + (default-id (car implicit-ids))) + (string-to-number + (completing-read (if default-id + (format "Bug #ID (default %s): " default-id) + "Bug #ID: ") + implicit-ids + (lambda (s) (string-match-p "\\`[0-9]+\\'" s)) + nil nil nil (car implicit-ids)))) + current-prefix-arg + (when (derived-mode-p 'message-mode) + (current-buffer))))) + (let* ((status (debbugs-gnu-current-status)) + (version + (when (and + (member message '("close" "done" "fixed" "found")) + (member "emacs" (cdr (assq 'package status)))) + (save-excursion + (read-string + "Version: " + (pcase (nbutlast (version-to-list emacs-version) + ;; Chop off build number, if needed. + (if (boundp 'emacs-build-number) + 0 + 1)) + (`(,major ,minor ,_micro) ; Development version. + (format "%d.%d" major (if (equal message "found") + minor + (1+ minor)))) + (`(,major ,minor) ; Release version. + (format "%d.%d" major minor)) + ;; Unexpected version format? + (_ emacs-version))))))) + (unless buffer + (setq buffer + (pop-to-buffer + (get-buffer-create + (format "*Debbugs Control Message for #%d*" bugid))))) + (set-buffer buffer) + (when (= (buffer-size) 0) + (insert "To: control@debbugs.gnu.org\n" + "From: " (message-make-from) "\n" + (format "Subject: control message for bug #%d\n" bugid) + mail-header-separator + "\n")) + (unless (or (derived-mode-p 'message-mode) + ;; `message-mode' associates buffer with file, we + ;; don't want to do that for temp buffers. + (eq (aref (buffer-name) 0) ?\s)) + (message-mode)) + (save-restriction + (message-narrow-to-head) + (let* ((ctrl-addr "control@debbugs.gnu.org") + (ctrl-re (regexp-quote ctrl-addr)) + (to-addr (message-fetch-field "to")) + (bcc-addr (message-fetch-field "bcc"))) + (unless (or (and to-addr (string-match-p ctrl-re to-addr)) + (and bcc-addr (string-match-p ctrl-re bcc-addr))) + (message-add-header + (format "%s: %s" (if to-addr "Bcc" "To") ctrl-addr))))) + (message-goto-body) + (while (looking-at-p debbugs-gnu-control-message-commands-regexp) + (forward-line)) + (insert + (save-excursion ; Point can change while prompting! + (cond + ((member message '("unarchive" "unmerge" "noowner" + "notfixed" "notforwarded")) + (format "%s %d\n" message bugid)) + ((equal message "reopen") + (format "reopen %d\ntag %d - fixed patch\n" bugid bugid)) + ((member message '("merge" "forcemerge")) + (format + "%s %d %s\n" message bugid + (mapconcat + 'identity + (debbugs-gnu-expand-bug-number-list + (completing-read-multiple + (format "%s with bug(s) #: " (capitalize message)) + debbugs-gnu-completion-table)) + " "))) + ((member message '("block" "unblock")) + (format + "%s %d by %s\n" message bugid + (mapconcat + 'identity + (debbugs-gnu-expand-bug-number-list + (completing-read-multiple + (format "%s with bug(s) #: " (capitalize message)) + (if (equal message "unblock") + (mapcar 'number-to-string + (cdr (assq 'blockedby status))) + debbugs-gnu-completion-table) + nil (and (equal message "unblock") status))) + " "))) + ((equal message "owner") + (format "owner %d !\n" bugid)) + ((equal message "retitle") + (format "retitle %d %s\n" bugid (read-string "New title: "))) + ((equal message "forwarded") + (format "forwarded %d %s\n" bugid (read-string "Forward to: "))) + ((equal message "reassign") + (format "reassign %d %s\n" bugid (read-string "Package(s): "))) + ((equal message "close") + (format "close %d %s\n" bugid (or version ""))) + ((equal message "done") + (format "tags %d fixed\nclose %d %s\n" bugid bugid version)) + ((member message '("found" "notfound" "fixed")) + (format "%s %d %s\n" message bugid version)) + ((member message '("donenotabug" "donewontfix" + "doneunreproducible")) + (format "tags %d %s\nclose %d\n" bugid (substring message 4) bugid)) + ((member message '("serious" "important" "normal" + "minor" "wishlist")) + (format "severity %d %s\n" bugid message)) + ((equal message "invalid") + (format "tags %d notabug wontfix\nclose %d\n" + bugid bugid)) + ((equal message "documentation") + (format "user emacs\nusertag %d %s\n" bugid "documentation")) + ((equal message "usertag") + (format "user %s\nusertag %d %s\n" + (completing-read + "Package name or email address: " + (append + debbugs-gnu-all-packages (list user-mail-address)) + nil nil (car debbugs-gnu-default-packages)) + bugid (read-string "User tag: "))) + (t + (format "tags %d %c %s\n" + bugid (if reverse ?- ?+) + message))))) + (unless (looking-at-p debbugs-gnu-control-message-end-regexp) + (insert "quit\n\n")))) + (defvar debbugs-gnu-usertags-mode-map (let ((map (make-sparse-keymap))) diff --git a/packages/debbugs/debbugs-org.el b/packages/debbugs/debbugs-org.el index a0e86b730..ecdcaa731 100644 --- a/packages/debbugs/debbugs-org.el +++ b/packages/debbugs/debbugs-org.el @@ -82,6 +82,7 @@ ;; keystrokes: ;; "C-c # C": Send a debbugs control message +;; "C-c # E": Make (but don't yet send) a debbugs control message ;; "C-c # t": Mark the bug locally as tagged ;; "C-c # d": Show bug attributes @@ -293,6 +294,7 @@ (defconst debbugs-org-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c # t") 'debbugs-gnu-toggle-tag) (define-key map (kbd "C-c # C") 'debbugs-gnu-send-control-message) + (define-key map (kbd "C-c # E") 'debbugs-gnu-make-control-message) (define-key map (kbd "C-c # d") 'debbugs-gnu-display-status) map) "Keymap for the `debbugs-org-mode' minor mode.") diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi index 0a335129d..d7d94ec41 100644 --- a/packages/debbugs/debbugs-ug.texi +++ b/packages/debbugs/debbugs-ug.texi @@ -426,6 +426,13 @@ Toggle showing of closed bugs. @code{debbugs-gnu-send-control-message} @* Send a control message for this bug, @ref{Control Messages}. +@item +@kindex @kbd{C} +@kbd{C} @tab +@code{debbugs-gnu-make-control-message} @* +Make (but don't yet send) a control message for this bug, @ref{Control +Messages}. + @end multitable @vindex debbugs-gnu-suppress-closed @@ -482,6 +489,13 @@ Toggle local tag of bugs. @code{debbugs-gnu-send-control-message} @* Send a control message for this bug, @ref{Control Messages}. +@item +@kindex @kbd{C-c # E} +@kbd{C-c # E} @tab +@code{debbugs-gnu-make-control-message} @* +Make (but don't yet send) a control message for this bug, @ref{Control +Messages}. + @end multitable When the bug attributes are shown by @code{org-cycle}, there is a link @@ -550,6 +564,14 @@ If the command invoking the control message has been prefixed with The second argument in the close message, the Emacs version, is read interactively if the bug belongs to the @code{"emacs"} package. +@item found +@itemx notfound +@itemx fixed +"found|notfound|fixed 12345 25.1" + +The second argument, the Emacs version, is read interactively if the +bug belongs to the @code{"emacs"} package. + @item forwarded "forwarded 12345 @var{address}" @@ -606,6 +628,11 @@ The new bug title is read interactively. The username, read interactively, is either a package name or an email address. The tag to be set is also read interactively. + +@item documentation +"user emacs" @* +"usertag 12345 documentation" + @end table @vindex debbugs-gnu-send-mail-function -- 2.11.0 --=-=-=--