emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/debbugs 6d52539 143/311: Support reading debbugs email


From: Stefan Monnier
Subject: [elpa] externals/debbugs 6d52539 143/311: Support reading debbugs email exchange with Rmail
Date: Sun, 29 Nov 2020 18:41:58 -0500 (EST)

branch: externals/debbugs
commit 6d52539470ca642ffad0b9b3488eed80bcff1e56
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Support reading debbugs email exchange with Rmail
    
    * 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'.
---
 debbugs-gnu.el  | 79 +++++++++++++++++++++++++++++++++++++++++++++++----------
 debbugs-ug.info | 31 +++++++++++++---------
 debbugs-ug.texi | 17 +++++++++----
 3 files changed, 97 insertions(+), 30 deletions(-)

diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 210554f..bada55b 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -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
@@ -158,6 +158,9 @@
 (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)))
diff --git a/debbugs-ug.info b/debbugs-ug.info
index 25b92ea..227ea28 100644
--- a/debbugs-ug.info
+++ b/debbugs-ug.info
@@ -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.
+
 
 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)
 
 
 File: debbugs-ug.info,  Node: Key Index,  Prev: Variable Index,  Up: Top
@@ -560,11 +567,11 @@ Ref: Searching Bugs-Footnote-110016
 Ref: Searching Bugs-Footnote-210104
 Node: Layout10195
 Node: Tabulated Lists10670
-Node: TODO Items13173
-Node: Control Messages14438
-Node: Minor Mode16733
-Node: Command Index17671
-Node: Variable Index18332
-Node: Key Index18921
+Node: TODO Items13493
+Node: Control Messages14758
+Node: Minor Mode17069
+Node: Command Index18007
+Node: Variable Index18668
+Node: Key Index19330
 
 End Tag Table
diff --git a/debbugs-ug.texi b/debbugs-ug.texi
index d96c62b..4af04f5 100644
--- a/debbugs-ug.texi
+++ b/debbugs-ug.texi
@@ -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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]