Subject: [debbugs.el] debbugs-make-control-message doesn't always ask for version

From: Noam Postavsky <[email-masked]>
Date: Wed, 03 Apr 2019 09:20:30 -0400

Severity: minor
Tags: patch

When using debbugs-make-control-message to make a "done" or "fixed"
control message from a message-mode buffer, it doesn't ask for for a
version number.  That's because (debbugs-gnu-current-status) returns nil
outside the *Bugs* buffer, so the (member "emacs" (cdr (assq 'package
status))) check always fails.

I think it should be okay to fallback to cache, or debbugs-get-status if
the cache is empty, right?

By the way, I wonder if we should ask for version even if the package is
not Emacs (obviously the initial-input suggestion only works for Emacs),
surely other packages have versions too?

>From fbaec0d15b816892c5f774ea9cfdfa6536956d8e Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Wed, 3 Apr 2019 09:03:13 -0400
Subject: [PATCH v1] Try harder to debbugs status if d-g-current-status missing

* packages/debbugs/debbugs-gnu.el (debbugs-gnu-make-control-message):
Fallback to debbugs-cache-data or debbugs-get-status if
debbugs-gnu-current-status returns nil, otherwise we fail to ask for
version number when fixing/finding/closing/etc Emacs bugs from a
message-mode buffer.
---
 packages/debbugs/debbugs-gnu.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 33860c2d5..8f914d5c1 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -1586,7 +1586,9 @@ (defun debbugs-gnu-make-control-message (message bugid &optional reverse buffer)
            current-prefix-arg
            (when (derived-mode-p 'message-mode)
              (current-buffer)))))
-  (let* ((status (debbugs-gnu-current-status))
+  (let* ((status (or (debbugs-gnu-current-status)
+                     (gethash bugid debbugs-cache-data)
+                     (debbugs-get-status bugid)))
          (version
           (if (and
                (member message '("close" "done"
-- 
2.11.0