emacs-devel
[Top][All Lists]
Advanced

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

Re: bug#38136: [PATCH] Make gnus-group-get-new-news a non blocking threa


From: Robert Pluim
Subject: Re: bug#38136: [PATCH] Make gnus-group-get-new-news a non blocking thread
Date: Fri, 22 Nov 2019 12:15:48 +0100

>>>>> On Fri, 22 Nov 2019 09:30:49 +0100, Michael Albinus <address@hidden> said:

>> +(defvar debbugs-gnu-read-bugs-limit 10)

    Michael> I would make it a defcustom. Maybe we need also another defconst, 
which
    Michael> is the upper limit this user option can be. Something like 50, or 
100.

If we make it a defcustom we can encode checking the max in the
defcustom form.

    Michael> That works so far for me, thanks. What I'm missing is handling of 
merged
    Michael> bugs. That is, if a bug in a line shows also merged bug numbers.

Yes, done.

    Michael> We would need also a command debbugs-gnu-read-current-bugs and key
    Michael> bindings for this. Just to be prepared for a possible
    Michael> debbugs-gnu-read-current-bugs-with-rmail.

I chose 'A' for 'A'll, and did some renaming. Suggestions welcome.

    Michael> If this is too much for your limited time, commit what you have, 
and I
    Michael> will adapt the final bits then.

"You get what anybody gets: you get a lifetime" :-)

    >> (defun debbugs-read-tagged-bugs-with-gnus ()
    >> "Create an ephemeral Gnus group of locally tagged Emacs bugs."

    Michael> I believe, this one is not needed anymore. A list with locally 
tagged
    Michael> bugs is created now easily via debbugs-gnu-tagged. And there you 
call
    Michael> debbugs-gnu-read-current-bugs.

Yes, it was left over, Iʼve removed it.

>From 2378e7a1529fa372c1bc9aee0373b380df6602a2 Mon Sep 17 00:00:00 2001
From: Robert Pluim <address@hidden>
Date: Fri, 22 Nov 2019 11:49:27 +0100
Subject: [PATCH] Add command to show mailboxes for all currently shown reports

* debbugs-gnu.el (debbugs-gnu-mode-map): Add binding for 
debbugs-gnu-select-current-bugs.
(debbugs-gnu-select-bugs-limit-max): New defconst.  Max for 
debbugs-gnu-select-bugs-limit.
(debbugs-gnu-select-bugs-limit): New defcustom.  Limits how many bugs
debbugs-gnu-select-current-bugs will retrieve.
(debbugs-gnu-select-current-bugs): New function. Shows mailboxes
for all currently shown bugs.
(debbugs-gnu-select-current-bugs-with-gnus): Implementation of mailbox
retrieval using Gnus.

* debbugs-ug.texi (Tabulated Lists): Add description of 
debbugs-gnu-select-current-bugs.
---
 packages/debbugs/debbugs-gnu.el  | 48 +++++++++++++++++++++++++++++++-
 packages/debbugs/debbugs-ug.texi |  8 ++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 303b62557..a4755694d 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -971,6 +971,7 @@ (defvar debbugs-gnu-mode-map
     (set-keymap-parent map tabulated-list-mode-map)
     (define-key map "\r" 'debbugs-gnu-select-report)
     (define-key map [mouse-2] 'debbugs-gnu-select-report)
+    (define-key map "A" 'debbugs-gnu-select-current-bugs)
     (define-key map "g" 'debbugs-gnu-rescan)
     (define-key map "R" 'debbugs-gnu-show-all-blocking-reports)
     (define-key map "C" 'debbugs-gnu-send-control-message)
@@ -990,10 +991,14 @@ (defvar debbugs-gnu-mode-map
     (define-key menu-map [debbugs-gnu-select-report]
       '(menu-item "Show Reports" debbugs-gnu-select-report
                  :help "Show all reports belonging to this bug"))
+    (define-key-after menu-map [debbugs-gnu-select-current]
+      '(menu-item "Show Reports For All" debbugs-gnu-select-current-bugs
+                 :help "Show reports for all currently shown bugs")
+      'debbugs-gnu-select-report)
     (define-key-after menu-map [debbugs-gnu-rescan]
       '(menu-item "Refresh Bugs" debbugs-gnu-rescan
                  :help "Refresh bug list")
-      'debbugs-gnu-select-report)
+      'debbugs-gnu-select-current)
     (define-key-after menu-map [debbugs-gnu-show-all-blocking-reports]
       '(menu-item "Show Release Blocking Bugs"
                  debbugs-gnu-show-all-blocking-reports
@@ -1399,6 +1404,47 @@ (defun debbugs-read-emacs-bug-with-rmail (id status 
merged)
     (define-key rmail-mode-map "E" 'debbugs-gnu-make-control-message)
     (rmail-show-message 1)))
 
+(defconst debbugs-gnu-select-bugs-limit-max 50)
+(defcustom debbugs-gnu-select-bugs-limit 10
+  "Maximum number of bugs to retrieve for Gnus group.
+This applies for `debbugs-gnu-select-current-bugs.
+Maximum allowed value is 50 to avoid overloading the server."
+  :type '(integer
+          :validate
+          (lambda (widget)
+            (unless (<= 1
+                        (widget-value widget)
+                        debbugs-gnu-select-bugs-limit-max)
+              (widget-put widget :error
+                          "Invalid value: range is 1..50"))))
+  :version "27.1")
+
+(defun debbugs-gnu-select-current-bugs ()
+  "Retrieve the mailboxes for all currently shown bugs.
+Limited by `debbugs-gnu-select-bugs-limit'."
+  (interactive)
+  (unless (eq debbugs-gnu-mail-backend 'gnus)
+    (error "This function only works with Gnus."))
+  (debbugs-gnu-select-current-bugs-with-gnus))
+
+(defun debbugs-gnu-select-current-bugs-with-gnus ()
+  "Create a Gnus group of the messages from the currently shown bugs."
+  (save-excursion
+    (let ((mbox-url
+           (replace-regexp-in-string
+            ";mboxstat=yes" ""
+            (alist-get 'emacs gnus-bug-group-download-format-alist)
+            nil t))
+          ids)
+      (goto-char (point-min))
+      (dotimes (i debbugs-gnu-select-bugs-limit)
+        (push (debbugs-gnu-current-id t) ids)
+        (push (cdr (assq 'mergedwith (debbugs-gnu-current-status))) ids)
+        (forward-line 1))
+      (setq ids (delete nil (nreverse ids)))
+      (gnus-read-ephemeral-bug-group ids mbox-url)
+      (debbugs-gnu-summary-mode 1))))
+
 (defcustom debbugs-gnu-lars-workflow nil
   "If non-nil, set some Gnus vars as preferred by Lars."
   :type 'boolean
diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi
index 8121f7bf8..6e86194e5 100644
--- a/packages/debbugs/debbugs-ug.texi
+++ b/packages/debbugs/debbugs-ug.texi
@@ -373,6 +373,14 @@
 Show the email messages that discuss the bug.
 
 @* @item
+@kindex @kbd{A}
+@kbd{A} @tab
+@code{debbugs-gnu-select-current-bugs} @*
+Show the email messages for all currently displayed messages
+(including merged reports).  Limited by user option
+@code{debbugs-gnu-select-bugs-limit}.
+
+@item
 @kindex @kbd{d}
 @kbd{d} @tab
 @code{debbugs-gnu-display-status} @*
-- 
2.24.0.155.gd9f6f3b619


reply via email to

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