]> code.delx.au - gnu-emacs-elpa/commitdiff
Support reading debbugs email exchange with Rmail
authorEli Zaretskii <eliz@gnu.org>
Sat, 14 Nov 2015 15:51:45 +0000 (17:51 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 Nov 2015 15:51:45 +0000 (17:51 +0200)
* packages/debbugs/debbugs-gnu.el: Version: bump to 0.8.
(debbugs-gnu-mail-backend): New defcustom.
(debbugs-read-emacs-bug-with-rmail): New function.
(debbugs-gnu-select-report): Call it if debbugs-gnu-mail-backend
is set to use Rmail.

* packages/debbugs/debbugs-ug.texi (Tabulated Lists): Describe the
new option 'debbugs-gnu-mail-backend'.

packages/debbugs/debbugs-gnu.el
packages/debbugs/debbugs-ug.info
packages/debbugs/debbugs-ug.texi

index 210554f6c25fdffe3c56f2333677456d5f1b5613..bada55bbd96bfb31f61ecb263d624bc28cb4e35e 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 ()
@@ -237,6 +240,15 @@ suppressed bugs is toggled by `debbugs-gnu-toggle-suppress'."
 (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.")
 
@@ -1065,6 +1077,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)
@@ -1072,17 +1120,22 @@ 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 (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)))
index 25b92ea51d9e8188d4dc60a4f1d401fc5fcf7632..227ea28fd3759159c340e55ed2a47525158a479c 100644 (file)
@@ -1,4 +1,4 @@
-This is debbugs-ug.info, produced by makeinfo version 5.2 from
+This is debbugs-ug.info, produced by makeinfo version 6.0 from
 debbugs-ug.texi.
 
 Copyright (C) 2015 Free Software Foundation, Inc.
@@ -306,7 +306,7 @@ shown with inverse face ('debbugs-gnu-archived').
 This enables the following key strokes:
 
 '<RET>'       'debbugs-gnu-select-report'
-'<mouse-1>'   Open a GNUS ephemeral group for that bug.
+'<mouse-1>'   Show the email messages that discuss the bug.
 '<mouse-2>'   
               
 'd'           'debbugs-gnu-display-status'
@@ -332,6 +332,12 @@ This enables the following key strokes:
               Send a control message for this bug, *note Control Messages::.
               
 
+   The user option 'debbugs-gnu-mail-backend' controls the presentation
+of email messages produced by typing '<RET>' or by clicking the mouse on
+a bug: if its value is 'gnus', the default, a GNUS ephemeral group for
+that bug will be shown; if its value is 'rmail', the command will
+present an Rmail folder instead.
+
 \1f
 File: debbugs-ug.info,  Node: TODO Items,  Next: Control Messages,  Prev: Tabulated Lists,  Up: Layout
 
@@ -380,10 +386,10 @@ server.  Their format is described in
 <http://debbugs.gnu.org/server-control.html>.
 
    A control message can be initiated in the tabulated list of bugs, in
-the list of org TODO items, or in the GNUS ephemeral group opened for
-the messages belonging to a given bug.  Control messages can be sent to
-unarchived bugs only, in case a bug is archived the control message
-'unarchive' must be sent first.
+the list of org TODO items, or in the GNUS ephemeral group or Rmail
+folder opened for the messages belonging to a given bug.  Control
+messages can be sent to unarchived bugs only, in case a bug is archived
+the control message 'unarchive' must be sent first.
 
    In the minibuffer, the following control messages can be requested
 (assuming that 12345 is the bug the control message is intended for).
@@ -524,6 +530,7 @@ Variable Index
 * debbugs-gnu-default-hits-per-page:     Retrieving Bugs.      (line 61)
 * debbugs-gnu-default-packages:          Retrieving Bugs.      (line 57)
 * debbugs-gnu-default-severities:        Retrieving Bugs.      (line 57)
+* debbugs-gnu-mail-backend:              Tabulated Lists.      (line 62)
 
 \1f
 File: debbugs-ug.info,  Node: Key Index,  Prev: Variable Index,  Up: Top
@@ -560,11 +567,11 @@ Ref: Searching Bugs-Footnote-1\7f10016
 Ref: Searching Bugs-Footnote-2\7f10104
 Node: Layout\7f10195
 Node: Tabulated Lists\7f10670
-Node: TODO Items\7f13173
-Node: Control Messages\7f14438
-Node: Minor Mode\7f16733
-Node: Command Index\7f17671
-Node: Variable Index\7f18332
-Node: Key Index\7f18921
+Node: TODO Items\7f13493
+Node: Control Messages\7f14758
+Node: Minor Mode\7f17069
+Node: Command Index\7f18007
+Node: Variable Index\7f18668
+Node: Key Index\7f19330
 \1f
 End Tag Table
index d96c62b12ac4bae63a2abe117176f5bb5b38c942..4af04f507ef6c9ed496c8c3b6b17fdb3a9831d2c 100644 (file)
@@ -326,7 +326,7 @@ The bug report buffers have enabled the minor
 @kindex @kbd{@key{mouse-2}}
 @kbd{@key{mouse-2}} @tab
 @code{debbugs-gnu-select-report} @*
-Open a GNUS ephemeral group for that bug.@c (@pxref{xxx}).
+Show the email messages that discuss the bug.
 
 @* @item
 @kindex @kbd{d}
@@ -386,6 +386,13 @@ Send a control message for this bug, @ref{Control Messages}.
 
 @end multitable
 
+@vindex debbugs-gnu-mail-backend
+The user option @code{debbugs-gnu-mail-backend} controls the
+presentation of email messages produced by typing @kbd{@key{RET}} or
+by clicking the mouse on a bug: if its value is @code{gnus}, the
+default, a GNUS ephemeral group for that bug will be shown; if its
+value is @code{rmail}, the command will present an Rmail folder
+instead.
 
 @node TODO Items
 @section TODO Items
@@ -445,10 +452,10 @@ server.  Their format is described in
 @uref{http://debbugs.gnu.org/server-control.html}.
 
 A control message can be initiated in the tabulated list of bugs, in
-the list of org TODO items, or in the GNUS ephemeral group opened for
-the messages belonging to a given bug.  Control messages can be sent
-to unarchived bugs only, in case a bug is archived the control message
-@samp{unarchive} must be sent first.
+the list of org TODO items, or in the GNUS ephemeral group or Rmail
+folder opened for the messages belonging to a given bug.  Control
+messages can be sent to unarchived bugs only, in case a bug is
+archived the control message @samp{unarchive} must be sent first.
 
 In the minibuffer, the following control messages can be requested
 (assuming that 12345 is the bug the control message is intended for).