]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/debbugs/debbugs-gnu.el
Command to list blocking reports
[gnu-emacs-elpa] / packages / debbugs / debbugs-gnu.el
index 6d7180284d1d12e19cda38adb786a587c36a43bd..0136831dfa350d3a2f9a2505cf557aa07a6a8fc1 100644 (file)
@@ -6,7 +6,7 @@
 ;;         Michael Albinus <michael.albinus@gmx.org>
 ;; Keywords: comm, hypermedia, maint
 ;; Package: debbugs
-;; Version: 0.7
+;; Version: 0.8
 
 ;; This file is not part of GNU Emacs.
 
@@ -89,7 +89,7 @@
 ;; submitter, and the title of the bug.  On every bug line you could
 ;; apply the following actions by the following keystrokes:
 
-;;   RET: Show corresponding messages in Gnus
+;;   RET: Show corresponding messages in Gnus/Rmail
 ;;   "C": Send a control message
 ;;   "t": Mark the bug locally as tagged
 ;;   "b": Show bugs this bug is blocked by
 (autoload 'message-make-from "message")
 (autoload 'vc-dir-hide-up-to-date "vc-dir")
 (autoload 'vc-dir-mark "vc-dir")
+(autoload 'rmail-get-new-mail "rmail")
+(autoload 'rmail-show-message "rmail")
+(autoload 'rmail-summary "rmailsum")
 (defvar compilation-in-progress)
 
 (defgroup debbugs-gnu ()
   :group 'debbugs
   :version "24.1")
 
+(defvar debbugs-gnu-blocking-report 19759
+  "The ID of the current release report used to track blocking bug reports.")
+
 (defcustom debbugs-gnu-default-severities '("serious" "important" "normal")
   "*The list severities bugs are searched for.
 \"tagged\" is not a severity but marks locally tagged bugs."
              (const "sed")
              (const "vc-dwim")
              (const "woodchuck"))
-  :version "24.4")
+  :version "25.1")
 
 (defconst debbugs-gnu-all-packages
   (mapcar 'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
   "*List of all possible package names.")
 
-(defcustom debbugs-gnu-default-hits-per-page 500
+(defcustom debbugs-gnu-default-hits-per-page 3000
   "*The number of bugs shown per page."
   :group 'debbugs-gnu
   :type 'integer
@@ -234,6 +240,18 @@ suppressed bugs is toggled by `debbugs-gnu-toggle-suppress'."
   :type '(alist :key-type symbol :value-type regexp)
   :version "24.1")
 
+(defface debbugs-gnu-archived '((t (:inverse-video t)))
+  "Face for archived bug reports.")
+
+(defcustom debbugs-gnu-mail-backend 'gnus
+  "*The email backend to use for reading bug report email exchange.
+If this is 'gnus, the default, use Gnus.
+If this is 'rmail, use Rmail instead."
+  :group 'debbugs-gnu
+  :type '(choice (const :tag "Use Gnus" 'gnus)
+                (const :tag "Use Rmail" 'rmail))
+  :version "25.1")
+
 (defface debbugs-gnu-new '((t (:foreground "red")))
   "Face for new reports that nobody has answered.")
 
@@ -604,7 +622,7 @@ marked as \"client-side filter\"."
   ;; of them.
   (when (get-buffer (widget-get widget :buffer-name))
     (kill-buffer (widget-get widget :buffer-name)))
-  (pop-to-buffer (get-buffer-create (widget-get widget :buffer-name)))
+  (switch-to-buffer (get-buffer-create (widget-get widget :buffer-name)))
   (debbugs-gnu-mode)
   (let ((inhibit-read-only t)
        (debbugs-port "gnu.org"))
@@ -667,6 +685,8 @@ marked as \"client-side filter\"."
              words
              'face
              (cond
+              ((cdr (assq 'archived status))
+               'debbugs-gnu-archived)
               ((equal (cdr (assq 'pending status)) "done")
                'debbugs-gnu-done)
               ((member "pending" (cdr (assq 'keywords status)))
@@ -808,6 +828,7 @@ Used instead of `tabulated-list-print-entry'."
     (define-key map "b" 'debbugs-gnu-show-blocked-by-reports)
     (define-key map "B" 'debbugs-gnu-show-blocking-reports)
     (define-key map "C" 'debbugs-gnu-send-control-message)
+    (define-key map "R" 'debbugs-gnu-show-all-blocking-reports)
     map))
 
 (defun debbugs-gnu-rescan ()
@@ -960,6 +981,26 @@ The following commands are available:
        (message "Bug %d is not blocking any other bug" id)
       (apply 'debbugs-gnu-bugs (cdr (assq 'blocks status))))))
 
+(defun debbugs-gnu-show-all-blocking-reports ()
+  "Narrow the display to just the reports that are blocking a release."
+  (interactive)
+  (let ((blockers (cdr (assq 'blockedby
+                            (car (debbugs-get-status
+                                  debbugs-gnu-blocking-report)))))
+       (id (debbugs-gnu-current-id t))
+       (inhibit-read-only t)
+       status)
+    (setq debbugs-gnu-current-limit nil)
+    (goto-char (point-min))
+    (while (not (eobp))
+      (setq status (debbugs-gnu-current-status))
+      (if (not (memq (cdr (assq 'id status)) blockers))
+         (delete-region (point) (progn (forward-line 1) (point)))
+       (push (cdr (assq 'id status)) debbugs-gnu-current-limit)
+       (forward-line 1)))
+    (when id
+      (debbugs-gnu-goto id))))
+
 (defun debbugs-gnu-narrow-to-status (string &optional status-only)
   "Only display the bugs matching STRING.
 If STATUS-ONLY (the prefix), ignore matches in the From and
@@ -1060,6 +1101,42 @@ interest to you."
   (set-buffer-modified-p nil)
   (special-mode))
 
+(defvar rmail-current-message)
+(defvar rmail-total-messages)
+(defvar rmail-mode-map)
+(defvar rmail-summary-mode-map)
+
+(defun debbugs-read-emacs-bug-with-rmail (id status merged)
+  "Read email exchange for debbugs bug ID.
+STATUS is the bug's status list.
+MERGED is the list of bugs merged with this one."
+  (let* ((mbox-dir (make-temp-file "debbugs" t))
+        (mbox-fname (format "%s/bug_%d.mbox" mbox-dir id)))
+    (debbugs-get-mbox id 'mboxmaint mbox-fname)
+    (rmail mbox-fname)
+    ;; Download messages of all the merged bug reports and append them
+    ;; to the mailbox of the requested bug.
+    (when merged
+      (dolist (bugno merged)
+       (let ((fn (make-temp-file "url")))
+         (debbugs-get-mbox bugno 'mboxmaint fn)
+         (rmail-get-new-mail fn)
+         (delete-file fn)
+         ;; Remove the 'unseen' attribute from all the messages we've
+         ;; just read, so that all of them appear in the summary with
+         ;; the same face.
+         (while (< rmail-current-message rmail-total-messages)
+           (rmail-show-message (1+ rmail-current-message))))))
+    (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))))
+    (rmail-summary)
+    (define-key rmail-summary-mode-map "C" 'debbugs-gnu-send-control-message)
+    (set-window-text-height nil 10)
+    (other-window 1)
+    (define-key rmail-mode-map "C" 'debbugs-gnu-send-control-message)
+    (rmail-show-message 1)))
+
 (defun debbugs-gnu-select-report ()
   "Select the report on the current line."
   (interactive)
@@ -1067,17 +1144,24 @@ interest to you."
   (let* ((status (debbugs-gnu-current-status))
         (id (cdr (assq 'id status)))
         (merged (cdr (assq 'mergedwith status))))
-    (gnus-read-ephemeral-emacs-bug-group
-     (cons id (if (listp merged)
-                 merged
-               (list merged)))
-     (cons (current-buffer)
-          (current-window-configuration)))
-    (with-current-buffer (window-buffer (selected-window))
-      (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))))
+    (if (not id)
+       (message "No bug report on the current line")
+      (if (eq debbugs-gnu-mail-backend 'rmail)
+         (debbugs-read-emacs-bug-with-rmail id status (if (listp merged)
+                                                          merged
+                                                        (list merged)))
+       ;; Use Gnus.
+       (gnus-read-ephemeral-emacs-bug-group
+        (cons id (if (listp merged)
+                     merged
+                   (list merged)))
+        (cons (current-buffer)
+              (current-window-configuration)))
+       (with-current-buffer (window-buffer (selected-window))
+         (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)))