]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/debbugs/debbugs-gnu.el
* debbugs.texi: New file.
[gnu-emacs-elpa] / packages / debbugs / debbugs-gnu.el
index b9259e3ddbae2884f18538fa110832226057a0bb..5b832da2c051bb48e005f80101e54a6714984b4e 100644 (file)
 
 ;; It asks for the severities, for which bugs shall be shown. This can
 ;; be either just one severity, or a list of severities, separated by
-;; comma.  Valid severities are "important", "normal", "minor" or
-;; "wishlist".  There is also the pseudo severity "tagged", which
-;; selects locally tagged bugs.
+;; comma.  Valid severities are "serious", "important", "normal",
+;; "minor" or "wishlist".  Severities "critical" and "grave" are not
+;; used, although configured on the GNU bug tracker.  If no severity
+;; is given, all bugs are selected.
 
-;; If a prefix is given, more search parameters are asked for, like
-;; packages (also a comma separated list, "emacs" is the default),
-;; whether archived bugs shall be shown, and whether closed bugs shall
-;; be shown.
+;; There is also the pseudo severity "tagged", which selects locally
+;; tagged bugs.
+
+;; If a prefix is given to the command, more search parameters are
+;; asked for, like packages (also a comma separated list, "emacs" is
+;; the default), whether archived bugs shall be shown, and whether
+;; closed bugs shall be shown.
 
 ;; The bug reports are downloaded from the bug tracker.  In order to
 ;; not generate too much load of the server, up to 500 bugs will be
 
 ;; Furthermore, you could apply the global actions
 
-;;   "s": Toggle bug sorting
 ;;   "g": Rescan bugs
-;;   "x": Suppress closed bugs
 ;;   "q": Quit the buffer
+;;   "s": Toggle bug sorting for age or for state
+;;   "x": Toggle suppressing of closed bugs
 
 ;; When you visit the related bug messages in Gnus, you could also
 ;; send control messages by keystroke "C".
 
+;; In the header line of every bug list page, you can toggle sorting
+;; per column by selecting a column with the mouse.  The sorting
+;; happens as expected for the respective column; sorting in the Title
+;; column is depending on whether you are the owner of a bug.
+
 ;;; Code:
 
 (require 'debbugs)
 (require 'widget)
+(require 'tabulated-list)
 (eval-when-compile (require 'cl))
 
+(autoload 'widget-convert "wid-edit.el")
 (autoload 'gnus-read-ephemeral-emacs-bug-group "gnus-group")
 (autoload 'mail-header-subject "nnheader")
 (autoload 'gnus-summary-article-header "gnus-sum")
   "*The list severities bugs are searched for.
 \"tagged\" is not a severity but marks locally tagged bugs."
   :group 'debbugs-gnu
-  :type '(set (const "important")
+  :type '(set (const "serious")
+             (const "important")
              (const "normal")
              (const "minor")
              (const "wishlist")
   "Face for new reports that nobody has answered.")
 
 (defface debbugs-gnu-handled '((t (:foreground "ForestGreen")))
-  "Face for new reports that have been modified recently.")
+  "Face for reports that have been modified recently.")
+
+(defface debbugs-gnu-pending '((t (:foreground "MidnightBlue")))
+  "Face for reports that have been modified recently.")
 
 (defface debbugs-gnu-stale '((t (:foreground "orange")))
-  "Face for new reports that nobody has answered.")
+  "Face for reports that have not been touched for a week.")
 
 (defface debbugs-gnu-done '((t (:foreground "DarkGrey")))
   "Face for closed bug reports.")
 (defun debbugs-gnu-get-bugs ()
   "Retrieve bugs numbers from debbugs.gnu.org according search criteria."
   (let ((debbugs-port "gnu.org")
-       ids)
-    (dolist (severity debbugs-gnu-current-severities)
-      (if (string-equal severity "tagged")
-         (setq ids (nconc ids (copy-sequence debbugs-gnu-local-tags)))
-       (dolist (package debbugs-gnu-current-packages)
-         (setq ids
-               (nconc ids
-                      (debbugs-get-bugs
-                       :package package
-                       :severity severity
-                       :archive debbugs-gnu-current-archive))))))
-    (sort ids '<)))
+       (args `(:archive ,debbugs-gnu-current-archive))
+       (ids (when (member "tagged" debbugs-gnu-current-severities)
+              (copy-sequence debbugs-gnu-local-tags))))
+    (dolist (severity (delete "tagged" debbugs-gnu-current-severities))
+      (when (not (zerop (length severity)))
+       (setq args (append args `(:severity ,severity)))))
+    (dolist (package debbugs-gnu-current-packages)
+      (when (not (zerop (length package)))
+       (setq args (append args `(:package ,package)))))
+    (sort (nconc ids (apply 'debbugs-get-bugs args)) '<)))
 
 (defvar debbugs-gnu-current-widget nil)
 
   (pop-to-buffer (get-buffer-create (widget-get widget :buffer-name)))
   (debbugs-gnu-mode)
   (let ((inhibit-read-only t)
-       (debbugs-port "gnu.org")
-       (suppress-done (widget-get widget :suppress-done)))
+       (debbugs-port "gnu.org"))
+
     (erase-buffer)
+    (set (make-local-variable 'debbugs-gnu-current-widget)
+        widget)
 
-    (when debbugs-gnu-widgets
-      (widget-insert "Page:")
-      (mapc
-       (lambda (obj)
-        (if (eq obj widget)
-            (widget-put obj :button-face 'widget-button-pressed)
-          (widget-put obj :button-face 'widget-button-face))
-        (widget-apply obj :create))
-       debbugs-gnu-widgets)
-      (widget-insert "\n\n"))
-
-    (dolist (status (sort (apply 'debbugs-get-status
-                                (widget-get widget :bug-ids))
-                         (lambda (s1 s2)
-                           (< (cdr (assq 'id s1))
-                              (cdr (assq 'id s2))))))
-      (when (or (not suppress-done)
-               (not (equal (cdr (assq 'pending status)) "done")))
-       (let* ((id (cdr (assq 'id status)))
-              (words
-               (mapconcat
-                'identity
-                (cons (cdr (assq 'severity status))
-                      (cdr (assq 'keywords status)))
-                ","))
-              (face (cond
-                     ((equal (cdr (assq 'pending status)) "done")
-                      'debbugs-gnu-done)
-                     ((= (cdr (assq 'date status))
-                         (cdr (assq 'log_modified status)))
-                      'debbugs-gnu-new)
-                     ((< (- (float-time)
-                            (cdr (assq 'log_modified status)))
-                         (* 60 60 24 4))
-                      'debbugs-gnu-handled)
-                     (t
-                      'debbugs-gnu-stale)))
-              (address (mail-header-parse-address
-                        (decode-coding-string (cdr (assq 'originator status))
-                                              'utf-8)))
-              (owner (if (cdr (assq 'owner status))
-                         (car (mail-header-parse-address
-                               (decode-coding-string (cdr (assq 'owner status))
-                                                     'utf-8)))))
-              (subject (decode-coding-string (cdr (assq 'subject status))
-                                             'utf-8))
-              merged)
-         (unless (equal (cdr (assq 'pending status)) "pending")
-           (setq words
-                 (concat words "," (cdr (assq 'pending status)))))
-         (when (setq merged (cdr (assq 'mergedwith status)))
-           (setq words (format "%s,%s"
-                               (if (numberp merged)
-                                   merged
-                                 (mapconcat 'number-to-string merged ","))
-                               words)))
-         (setq words (propertize words 'face face))
-         (setq address
-               (propertize
-                ;; Prefer the name over the address.
-                (or (cdr address)
-                    (car address))
-                'face
-                ;; Mark own submitted bugs.
-                (if (and (stringp (car address))
-                         (string-equal (car address) user-mail-address))
-                    'debbugs-gnu-tagged
-                  'default)))
-         (insert
-          (format "%5d %-20s [%-23s] %s\n"
-                  id
-                  (if (> (length words) 20)
-                      (propertize (substring words 0 20) 'help-echo words)
-                    words)
-                  (if (> (length address) 23)
-                      (propertize (substring address 0 23) 'help-echo address)
-                    address)
-                  ;; Mark owned bugs.
-                  (if (and (stringp owner)
-                           (string-equal owner user-mail-address))
-                      (propertize subject
-                                  'face 'debbugs-gnu-tagged 'help-echo subject)
-                    (propertize subject 'help-echo subject))))
-         (forward-line -1)
-         (put-text-property (point) (1+ (point)) 'debbugs-gnu-status status)
-         (put-text-property
-          (point-at-bol) (point-at-eol) 'mouse-face widget-mouse-face)
-         (when (memq id debbugs-gnu-local-tags)
-           (put-text-property
-            (+ (point) (- 5 (length (number-to-string id)))) (+ (point) 5)
-            'face 'debbugs-gnu-tagged))
-         (forward-line 1))))
-
-    (when debbugs-gnu-widgets
-      (widget-insert "\nPage:")
-      (mapc (lambda (obj) (widget-apply obj :create)) debbugs-gnu-widgets)
-      (widget-setup))
+    (dolist (status (apply 'debbugs-get-status (widget-get widget :bug-ids)))
+      (let* ((id (cdr (assq 'id status)))
+            (words
+             (mapconcat
+              'identity
+              (cons (cdr (assq 'severity status))
+                    (cdr (assq 'keywords status)))
+              ","))
+            (address (mail-header-parse-address
+                      (decode-coding-string (cdr (assq 'originator status))
+                                            'utf-8)))
+            (owner (if (cdr (assq 'owner status))
+                       (car (mail-header-parse-address
+                             (decode-coding-string (cdr (assq 'owner status))
+                                                   'utf-8)))))
+            (subject (decode-coding-string (cdr (assq 'subject status))
+                                           'utf-8))
+            merged)
+       (unless (equal (cdr (assq 'pending status)) "pending")
+         (setq words
+               (concat words "," (cdr (assq 'pending status)))))
+       (let ((packages (delete "emacs" (cdr (assq 'package status)))))
+         (when packages
+           (setq words (concat words "," (mapconcat 'identity packages ",")))))
+       (when (setq merged (cdr (assq 'mergedwith status)))
+         (setq words (format "%s,%s"
+                             (if (numberp merged)
+                                 merged
+                               (mapconcat 'number-to-string merged ","))
+                             words)))
+       (add-to-list
+        'tabulated-list-entries
+        (list
+         status
+         (vector
+          (propertize
+           (format "%5d" id)
+           'face
+           ;; Mark tagged bugs.
+           (if (memq id debbugs-gnu-local-tags)
+               'debbugs-gnu-tagged
+             'default))
+          (propertize
+           ;; Mark status and age.
+           words
+           'face
+           (cond
+            ((equal (cdr (assq 'pending status)) "done")
+             'debbugs-gnu-done)
+            ((member "pending" (cdr (assq 'keywords status)))
+             'debbugs-gnu-pending)
+            ((= (cdr (assq 'date status))
+                (cdr (assq 'log_modified status)))
+             'debbugs-gnu-new)
+            ((< (- (float-time)
+                   (cdr (assq 'log_modified status)))
+                (* 60 60 24 7))
+             'debbugs-gnu-handled)
+            (t
+             'debbugs-gnu-stale)))
+          (propertize
+           ;; Prefer the name over the address.
+           (or (cdr address)
+               (car address))
+           'face
+           ;; Mark own submitted bugs.
+           (if (and (stringp (car address))
+                    (string-equal (car address) user-mail-address))
+               'debbugs-gnu-tagged
+             'default))
+          (propertize
+           subject
+           'face
+           ;; Mark owned bugs.
+           (if (and (stringp owner)
+                    (string-equal owner user-mail-address))
+               'debbugs-gnu-tagged
+             'default))))
+        'append)))
+    (tabulated-list-init-header)
+    (tabulated-list-print)
 
     (set-buffer-modified-p nil)
-    (set (make-local-variable 'debbugs-gnu-current-widget)
-        widget)
     (goto-char (point-min))))
 
+(defun debbugs-gnu-print-entry (list-id cols)
+  "Insert a debbugs entry at point.
+Used instead of `tabulated-list-print-entry'."
+  ;; This shall be in `debbugs-gnu-show-reports'.  But
+  ;; `tabulated-list-print' erases the buffer, therefore we do it
+  ;; here.  (bug#9047)
+  (when (and debbugs-gnu-widgets (= (point) (point-min)))
+    (widget-insert "Page:")
+    (mapc
+     (lambda (obj)
+       (if (eq obj debbugs-gnu-current-widget)
+          (widget-put obj :button-face 'widget-button-pressed)
+        (widget-put obj :button-face 'widget-button-face))
+       (widget-apply obj :create))
+     debbugs-gnu-widgets)
+    (widget-insert "\n\n")
+    (save-excursion
+      (widget-insert "\nPage:")
+      (mapc (lambda (obj) (widget-apply obj :create)) debbugs-gnu-widgets)
+      (widget-setup)))
+
+  (when (or (not (widget-get debbugs-gnu-current-widget :suppress-done))
+           (not (equal (cdr (assq 'pending list-id)) "done")))
+    (let ((beg (point))
+         (pos 0)
+         (id               (aref cols 0))
+         (id-length        (nth 1 (aref tabulated-list-format 0)))
+         (state            (aref cols 1))
+         (state-length     (nth 1 (aref tabulated-list-format 1)))
+         (submitter        (aref cols 2))
+         (submitter-length (nth 1 (aref tabulated-list-format 2)))
+         (title            (aref cols 3))
+         (title-length     (nth 1 (aref tabulated-list-format 3))))
+      ;; Insert id.
+      (indent-to (- id-length (length id)))
+      (insert id)
+      ;; Insert state.
+      (indent-to (setq pos (+ pos id-length 1)) 1)
+      (insert (if (> (length state) state-length)
+                 (propertize (substring state 0 state-length)
+                             'help-echo state)
+               state))
+      ;; Insert submitter.
+      (indent-to (setq pos (+ pos state-length 1)) 1)
+      (insert "[" (if (> (length submitter) (- submitter-length 2))
+                     (propertize (substring submitter 0 (- submitter-length 2))
+                                 'help-echo submitter)
+                   submitter))
+      (indent-to (+ pos (1- submitter-length)))
+      (insert "]")
+      ;; Insert title.
+      (indent-to (setq pos (+ pos submitter-length 1)) 1)
+      (insert (propertize title 'help-echo title))
+      ;; Add properties.
+      (add-text-properties
+       beg (point) `(tabulated-list-id ,list-id mouse-face ,widget-mouse-face))
+      (insert ?\n))))
+
 (defvar debbugs-gnu-mode-map
   (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map tabulated-list-mode-map)
     (define-key map "\r" 'debbugs-gnu-select-report)
     (define-key map [mouse-1] 'debbugs-gnu-select-report)
     (define-key map [mouse-2] 'debbugs-gnu-select-report)
     (define-key map "t" 'debbugs-gnu-toggle-tag)
     (define-key map "d" 'debbugs-gnu-display-status)
     (define-key map "g" 'debbugs-gnu-rescan)
-    (define-key map "x" 'debbugs-gnu-suppress-done)
+    (define-key map "x" 'debbugs-gnu-toggle-suppress-done)
     (define-key map "C" 'debbugs-gnu-send-control-message)
     map))
 
 
 (defvar debbugs-gnu-sort-state 'number)
 
-(defun debbugs-gnu-mode ()
+(define-derived-mode debbugs-gnu-mode tabulated-list-mode "Debbugs"
   "Major mode for listing bug reports.
 
 All normal editing commands are switched off.
@@ -437,67 +493,89 @@ All normal editing commands are switched off.
 The following commands are available:
 
 \\{debbugs-gnu-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'debbugs-gnu-mode)
-  (setq mode-name "Debbugs")
-  (use-local-map debbugs-gnu-mode-map)
   (set (make-local-variable 'debbugs-gnu-sort-state)
        'number)
+  (setq tabulated-list-format [("Id"         5 debbugs-gnu-sort-id)
+                              ("State"     20 debbugs-gnu-sort-state)
+                              ("Submitter" 25 t)
+                              ("Title"     10 debbugs-gnu-sort-title)])
+  (setq tabulated-list-sort-key (cons "Id" nil))
+  (setq tabulated-list-printer 'debbugs-gnu-print-entry)
   (buffer-disable-undo)
   (setq truncate-lines t)
   (setq buffer-read-only t))
 
-(defvar debbugs-gnu-state-preference
+(defun debbugs-gnu-sort-id (s1 s2)
+  (< (cdr (assq 'id (car s1)))
+     (cdr (assq 'id (car s2)))))
+
+(defconst debbugs-gnu-state-preference
   '((debbugs-gnu-new . 1)
     (debbugs-gnu-stale . 2)
     (debbugs-gnu-handled . 3)
-    (debbugs-gnu-done . 4)))
+    (debbugs-gnu-done . 4)
+    (debbugs-gnu-pending . 5)))
+
+(defun debbugs-gnu-get-state-preference (face-string)
+  (or (cdr (assq (get-text-property 0 'face face-string)
+                debbugs-gnu-state-preference))
+      10))
+
+(defconst debbugs-gnu-severity-preference
+  '(("serious" . 1)
+    ("important" . 2)
+    ("normal" . 3)
+    ("minor" . 4)
+    ("wishlist" . 5)))
+
+(defun debbugs-gnu-get-severity-preference (state)
+  (or (cdr (assoc (cdr (assq 'severity state))
+                 debbugs-gnu-severity-preference))
+      10))
+
+(defun debbugs-gnu-sort-state (s1 s2)
+  (let ((id1 (cdr (assq 'id (car s1))))
+       (age1 (debbugs-gnu-get-state-preference (aref (nth 1 s1) 1)))
+       (id2 (cdr (assq 'id (car s2))))
+       (age2 (debbugs-gnu-get-state-preference (aref (nth 1 s2) 1))))
+    (cond
+     ;; Tagged bugs go to the end.
+     ((and (not (memq id1 debbugs-gnu-local-tags))
+          (memq id2 debbugs-gnu-local-tags))
+      t)
+     ((and (memq id1 debbugs-gnu-local-tags)
+          (not (memq id2 debbugs-gnu-local-tags)))
+      nil)
+     ;; Then, we check the age of the bugs.
+     ((< age1 age2)
+      t)
+     ((> age1 age2)
+      nil)
+     ;; If they have the same age, we check for severity.
+     ((< (debbugs-gnu-get-severity-preference (car s1))
+        (debbugs-gnu-get-severity-preference (car s2)))
+      t)
+     (t nil))))
+
+(defun debbugs-gnu-sort-title (s1 s2)
+  (let ((owner (if (cdr (assq 'owner (car s1)))
+                  (car (mail-header-parse-address
+                        (decode-coding-string (cdr (assq 'owner (car s1)))
+                                              'utf-8))))))
+    (and (stringp owner)
+        (string-equal owner user-mail-address))))
 
 (defun debbugs-gnu-toggle-sort ()
   "Toggle sorting by age and by state."
   (interactive)
-  (beginning-of-line)
-  (let ((buffer-read-only nil)
-       (before-change-functions nil)
-       (current-bug (debbugs-gnu-current-id t))
-       (start-point (point)))
-    (setq debbugs-gnu-sort-state
-         (if (eq debbugs-gnu-sort-state 'number)
-             'state
-           'number))
-    (goto-char (point-min))
-    (while (and (not (eobp))
-               (not (get-text-property (point) 'debbugs-gnu-status)))
-      (forward-line 1))
-    (save-restriction
-      (narrow-to-region
-       (point)
-       (progn
-        (goto-char (point-max))
-        (beginning-of-line)
-        (while (and (not (bobp))
-                    (not (get-text-property (point) 'debbugs-gnu-status)))
-          (forward-line -1))
-        (forward-line 1)
-        (point)))
-      (goto-char (point-min))
-      (sort-subr
-       nil (lambda () (forward-line 1)) 'end-of-line
-       (lambda ()
-        (let ((id (debbugs-gnu-current-id)))
-          (if (eq debbugs-gnu-sort-state 'number)
-              id
-            ;; Sort the tagged ones at the end.
-            (or (and (memq id debbugs-gnu-local-tags)
-                     20)
-                (cdr (assq (get-text-property (+ (point) 7) 'face)
-                           debbugs-gnu-state-preference))
-                10))))))
-    (if (not current-bug)
-       (goto-char start-point)
-      (goto-char (point-min))
-      (re-search-forward (format "^%d" current-bug) nil t))))
+  (if (eq debbugs-gnu-sort-state 'number)
+      (progn
+       (setq debbugs-gnu-sort-state 'state)
+       (setq tabulated-list-sort-key (cons "Id" nil)))
+    (setq debbugs-gnu-sort-state 'number)
+    (setq tabulated-list-sort-key (cons "State" nil)))
+  (tabulated-list-init-header)
+  (tabulated-list-print))
 
 (defun debbugs-gnu-toggle-tag ()
   "Toggle tag of the report in the current line."
@@ -516,24 +594,16 @@ The following commands are available:
         'face 'debbugs-gnu-tagged))))
   (debbugs-gnu-dump-persistency-file))
 
-(defun debbugs-gnu-suppress-done ()
+(defun debbugs-gnu-toggle-suppress-done ()
   "Suppress bugs marked as done."
   (interactive)
-  (save-excursion
-    (unless (widget-get debbugs-gnu-current-widget :suppress-done)
-      (let ((inhibit-read-only t))
-       (widget-put debbugs-gnu-current-widget :suppress-done t)
-       (goto-char (point-min))
-       (while (and (not (eobp))
-                   (not (get-text-property (point) 'debbugs-gnu-status)))
-         (forward-line 1))
-       (while  (and (not (eobp))
-                    (get-text-property (point) 'debbugs-gnu-status))
-         (if (equal (cdr (assq 'pending (debbugs-gnu-current-status))) "done")
-             (kill-region (point) (progn (forward-line 1) (point)))
-           (forward-line 1)))))))
+  (widget-put debbugs-gnu-current-widget :suppress-done
+             (not (widget-get debbugs-gnu-current-widget :suppress-done)))
+  (tabulated-list-init-header)
+  (tabulated-list-print))
 
 (defvar debbugs-gnu-bug-number nil)
+(defvar debbugs-gnu-subject nil)
 
 (defun debbugs-gnu-current-id (&optional noerror)
   (or (cdr (assq 'id (debbugs-gnu-current-status)))
@@ -541,8 +611,7 @@ The following commands are available:
           (error "No bug on the current line"))))
 
 (defun debbugs-gnu-current-status ()
-  (get-text-property (line-beginning-position)
-                    'debbugs-gnu-status))
+  (get-text-property (line-beginning-position) 'tabulated-list-id))
 
 (defun debbugs-gnu-display-status (status)
   "Display the status of the report on the current line."
@@ -566,8 +635,10 @@ The following commands are available:
      (cons (current-buffer)
           (current-window-configuration)))
     (with-current-buffer (window-buffer (selected-window))
-      (debbugs-gnu-summary-mode 1)
-      (set (make-local-variable 'debbugs-gnu-bug-number) id))))
+      (set (make-local-variable 'debbugs-gnu-bug-number) id)
+      (set (make-local-variable 'debbugs-gnu-subject)
+          (format "Re: bug#%d: %s" id (cdr (assq 'subject status))))
+      (debbugs-gnu-summary-mode 1))))
 
 (defvar debbugs-gnu-summary-mode-map
   (let ((map (make-sparse-keymap)))
@@ -582,7 +653,7 @@ The following commands are available:
 \\{debbugs-gnu-summary-mode-map}"
   :lighter " Debbugs" :keymap debbugs-gnu-summary-mode-map
   (set (make-local-variable 'gnus-posting-styles)
-       '((".*"
+       `((".*"
          (eval
           (with-current-buffer gnus-article-copy
             (set (make-local-variable 'message-prune-recipient-rules)
@@ -596,7 +667,10 @@ The following commands are available:
                        (let ((new (format "%s@debbugs.gnu.org"
                                           (match-string 1 (car address)))))
                          (cons new new))
-                     address)))))))))
+                     address)))
+            ;; `gnus-posting-styles' is eval'ed after
+            ;; `message-simplify-subject'.  So we cannot use m-s-s.
+            (setq subject ,debbugs-gnu-subject)))))))
 
 (defun debbugs-gnu-send-control-message (message &optional reverse)
   "Send a control message for the current bug report.
@@ -609,12 +683,14 @@ removed instead."
   (interactive
    (list (completing-read
          "Control message: "
-         '("important" "normal" "minor" "wishlist"
+         '("serious" "important" "normal" "minor" "wishlist"
            "done" "donenotabug" "donewontfix" "doneunreproducible"
            "unarchive" "reopen" "close"
            "merge" "forcemerge"
            "owner" "noowner"
-           "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug")
+           "invalid"
+           "patch" "wontfix" "moreinfo" "unreproducible" "fixed" "notabug"
+           "pending" "help" "security" "confirmed")
          nil t)
         current-prefix-arg))
   (let* ((id (or debbugs-gnu-bug-number        ; Set on group entry.
@@ -657,8 +733,12 @@ removed instead."
               ((member message '("donenotabug" "donewontfix"
                                  "doneunreproducible"))
                (format "tags %d %s\nclose %d\n" id (substring message 4) id))
-              ((member message '("important" "normal" "minor" "wishlist"))
+              ((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))
               (t
                (format "tags %d%s %s\n"
                        id (if reverse " -" "")
@@ -669,8 +749,4 @@ removed instead."
 
 ;;; TODO:
 
-;; * Widget-oriented bug overview like webDDTs.
-;; * Actions on bugs.
-;; * Integration into gnus (nnir).
-
 ;;; debbugs-gnu.el ends here