From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Bj=C3=B6rn?= Bidar Newsgroups: gmane.emacs.help Subject: Re: A few questions about debbugs Date: Sat, 31 Aug 2024 18:19:06 +0300 Message-ID: <15012.9120958567$1725117594@news.gmane.org> References: <871q2uelx6.fsf@thaodan.de> <87r0as992a.fsf@gmx.de> <87msl83hbe.fsf@gmx.de> <874j7e2rlg.fsf@gmx.de> <87ttfc3h7d.fsf@gmx.de> <87frqolvqj.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38978"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier via Users list for the GNU Emacs text editor , Stefan Monnier To: Michael Albinus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 31 17:19:46 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1skPtB-0009zu-7q for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 31 Aug 2024 17:19:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1skPsl-0005XE-U0; Sat, 31 Aug 2024 11:19:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1skPsi-0005X2-2J for help-gnu-emacs@gnu.org; Sat, 31 Aug 2024 11:19:16 -0400 Original-Received: from thaodan.de ([2a03:4000:4f:f15::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1skPsf-0006OE-Lw for help-gnu-emacs@gnu.org; Sat, 31 Aug 2024 11:19:15 -0400 Original-Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154]) by thaodan.de (Postfix) with ESMTPSA id 7D481D0004C; Sat, 31 Aug 2024 18:19:08 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1725117548; bh=lyel9MyWl0H665t52bVeJlOgqkgpJArOVQ61g1guNtk=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=YheFtV/8+U2uu+TPs9Kn8OhePPgWjUdXL5pKfpIfUbCk3glnX6Gq7d1s+qYeZYX01 jdcIfugrUhUcEliY7hmMGOg5Tdu+v/r2lU8kQ1fJFEpmKRSgrkghzRNtYDo4iIYxZN bIQexWdr72BsyRxrg0txhrZUhRNAYfRxI30D9b1U0iAiKLued/RWvvg0hLGv7e3Xd1 FHkZo4G09CUaZQApTZz4R/ANiDrPOJfAO/mc8kyN9wlGlb5gHvzTp0sBtwJ8iUF71y a+NyN8/Jigzsm8dOfRErCJkjTN9cR7uk+vCyIFB7pWkjd42tHizZYoMk3m9KLfvU05 Yfo6D8NVr0FJjzp8fMdtYepC5KNMKv+EQZjMZt+1uyh/5/Rq7iHYf/TcfHKNRdHLTL NE/ruxbCeFZYOGCFdzvvWLPrgIsMpifBNsANDHaud0e9WWPEUxf5srm5rLosroa+DW EzxzKN/mSzKVhh7XkNzXhIKFOTKXmgG9O4WR7f5GIB1JOhFFT15wkVqinns5hAcmGU m1t95oUcwdUePpz17+73OqIzOzHZ1h2usd77SOZ8h2Uf179qt98gszjQf5yKPeAQuB ACRktcpWEeR2a1+m7d9yPDFjOlmyx5NavWYK2LTS6VN3vNpi1dwnzDEp+9uenQETfP X1iNaWifkjwcfkstwxLyIssk= In-Reply-To: <87frqolvqj.fsf@gmx.de> (Michael Albinus's message of "Wed, 28 Aug 2024 13:42:12 +0200") Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH Received-SPF: pass client-ip=2a03:4000:4f:f15::1; envelope-from=bjorn.bidar@thaodan.de; helo=thaodan.de X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, INVALID_MSGID=0.568, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147862 Archived-At: Michael Albinus writes: > Michael Albinus writes: > > Hi, > >>>> Replacing soap-invoke by soap-invoke-async is not a problem. What I >>>> worry about is the UI. If you invoke debbugs-search, and you do >>>> something else in Emacs then, you need a proper way how to present the >>>> search results to the user w/o interrupting the work she is doing >>>> meanwhile. >>> >>> Indeed displaying the buffer asynchronously is too disruptive. >>> >>> The usual way to do that in Emacs is to immediately display the (empty) >>> result buffer and then maybe emit a `message` when this buffer has >>> been filled. >> >> Thanks for the explanation. I'll give it a try for debbugs-{gnu,org}-search. > > I've assembled a proof-of-concept for debbugs-gnu-search, see appended > patch. It is on top of the ELPA git repository, but it might apply also > on the last distributed debbugs release (didn't check). Feedback appreciated. Could you next time create a branch with the patch in debbugs git so it's easier to test the patch if already using debbugs from git? To bad Debbugs-gnus-apply-patch only works for Emacs :D Applying a patch with Gnus was harder than it should be, I have to somehow integrate diff-mode and then magit-apply-patch better in Gnus. But that's OT anyway. > Best regards, Michael. > > diff --git a/debbugs-gnu.el b/debbugs-gnu.el > index 68599cff7f..5acb10af16 100644 > --- a/debbugs-gnu.el > +++ b/debbugs-gnu.el > @@ -457,6 +457,9 @@ a date, value is the cons cell (BEFORE . AFTER).") > The specification which bugs shall be suppressed is taken from > `debbugs-gnu-default-suppress-bugs'.") > > +(defvar debbugs-gnu-current-buffer nil > + "The current buffer results are presented in.") > + > (defvar debbugs-gnu-current-print-function #'tabulated-list-print > "Which function to apply printing the tabulated list.. > See `debbugs-gnu-package' for an alternative.") > @@ -680,8 +683,12 @@ depend on PHRASE being a string, or nil. See Info node > elt)) > > ;; Do the search. > - (debbugs-gnu severities packages archivedp) > - (message "Search finished")) > + (make-thread > + (lambda () > + (debbugs-gnu severities packages archivedp) > + (message > + (substitute-command-keys > + "Search finished, visit buffer via \\[debbugs-gnu-show-last-result]"))))) I think it would also be an option to have a flag to open the search results by default after they are found. For searches that should not take long this is the expected behavior especially for new users. > ;;;###autoload > (defun debbugs-gnu-patches () > @@ -855,6 +862,13 @@ This function assumes the variable `user-mail-address' is defined." > (interactive) > (apply #'debbugs-gnu-bugs (debbugs-get-bugs :submitter "me" :status "open"))) > > +;;;###autoload > +(defun debbugs-gnu-show-last-result () > + "Switch to buffer with the recent retrieved bugs" > + (interactive) > + (when (ignore-errors (get-buffer debbugs-gnu-current-buffer)) > + (pop-to-buffer-same-window debbugs-gnu-current-buffer))) What's the reason for pop-to-buffer-same-window, shouldn't the user be able to choose where the search results are opened? Personally I would use display-buffer and than customize if the buffer should be opened in the same buffer. > (defun debbugs-gnu-get-bugs (query) > "Retrieve bug numbers from debbugs.gnu.org according search criteria." > (let* ((bugs (assq 'bugs query)) > @@ -874,7 +888,18 @@ This function assumes the variable `user-mail-address' is defined." > (if phrase > (cond > ((eq (car elt) 'phrase) > - (list (list :phrase (cdr elt)))) > + (let ((str (cdr elt)) > + res) > + (while (string-match > + (rx (1+ space) (group (or "MAX" "SKIP")) > + (1+ space) (group (1+ digit)) eol) > + str) > + (push (string-to-number (match-string 2 str)) res) > + (push > + (intern (concat ":" (downcase (match-string 1 str)))) > + res) > + (setq str (replace-match "" nil nil str))) > + (list (append (list :phrase str) res)))) > ((memq (car elt) '(date @cdate)) > (list (list (intern (concat ":" (symbol-name (car elt)))) > (cddr elt) (cadr elt) > @@ -918,19 +943,21 @@ This function assumes the variable `user-mail-address' is defined." > If OFFLINE is non-nil, the query is not sent to the server. Bugs > are taken from the cache instead." > (let* ((inhibit-read-only t) > - string > - (buffer-name > + string) > + (setq debbugs-gnu-current-buffer > (cond > ((setq string (alist-get 'phrase debbugs-gnu-current-query)) > (format "*%S Bugs*" string)) > ((setq string (alist-get 'package debbugs-gnu-current-query)) > (format "*%s Bugs*" (capitalize string))) > - (t "*Bugs*")))) > + (t "*Bugs*"))) > ;; The tabulated mode sets several local variables. We must get > ;; rid of them. > - (when (get-buffer buffer-name) > - (kill-buffer buffer-name)) > - (pop-to-buffer-same-window (get-buffer-create buffer-name)) > + (when (get-buffer debbugs-gnu-current-buffer) > + (kill-buffer debbugs-gnu-current-buffer)) > + (funcall > + (if (debbugs-show-progress) #'pop-to-buffer-same-window #'set-buffer) > + (get-buffer-create debbugs-gnu-current-buffer)) > (debbugs-gnu-mode) > > ;; Print bug reports. > diff --git a/debbugs.el b/debbugs.el > index 627cdf163d..b04256a243 100644 > --- a/debbugs.el > +++ b/debbugs.el > @@ -135,6 +135,11 @@ OPERATION-NAME and PARAMETERS are as described in `soap-invoke'." > "Whether progress report is shown." > :type 'boolean) > > +(defun debbugs-show-progress () > + "Whether progress report is shown." > + (and debbugs-show-progress > + (or (not main-thread) (eq main-thread (current-thread))))) > + > (defvar debbugs-progress-reporter nil > "The progress reporter. > Don't set this globally, it shall be let-bound.") > @@ -154,7 +159,7 @@ Don't set this globally, it shall be let-bound.") > (defun debbugs-url-display-message-or-percentage (&rest args) > "Update progress reporter." > (ignore-errors > - (when (and debbugs-show-progress debbugs-progress-reporter) > + (when (and (debbugs-show-progress) debbugs-progress-reporter) > ;; The fingerprint of `url-display-percentage' is FMT PERC &REST > ;; ARGS. Since Emacs 29.1, this is obsolete and replaced by > ;; `url-display-message', which should also carry the percentage > @@ -256,10 +261,10 @@ patch: > :status \"forwarded\" > :severity \"serious\")" > (let ((debbugs-progress-reporter > - (and debbugs-show-progress > + (and (debbugs-show-progress) > (make-progress-reporter "Get bug numbers..." 0 100))) > debbugs-progress-reporter-buffers url-show-status vec kw key val) > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (add-function > :override > (symbol-function debbugs-url-display-message-or-percentage-function) > @@ -305,7 +310,7 @@ patch: > (error "Unknown key: %s" (car query))) > (prog1 > (sort (car (soap-invoke debbugs-wsdl debbugs-port "get_bugs" vec)) #'<) > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (remove-function > (symbol-function debbugs-url-display-message-or-percentage-function) > "debbugs-url-display-message-or-percentage") > @@ -486,10 +491,10 @@ Example: > ;; Retrieve bugs asynchronously. > (let ((bug-ids bug-numbers) > (debbugs-progress-reporter > - (and debbugs-show-progress > + (and (debbugs-show-progress) > (make-progress-reporter "Get bug information..." 0 100))) > debbugs-progress-reporter-buffers url-show-status results res) > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (add-function > :override > (symbol-function debbugs-url-display-message-or-percentage-function) > @@ -513,7 +518,7 @@ Example: > (last bug-ids (- (length bug-ids) > debbugs-max-hits-per-request)))) > > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (dolist (res results) > (push `(,res . 0) debbugs-progress-reporter-buffers))) > > @@ -521,11 +526,11 @@ Example: > (setq res (nth (random (length results)) results)) > (if (process-live-p (get-buffer-process res)) > (accept-process-output (get-buffer-process res)) > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (setcdr (assq res debbugs-progress-reporter-buffers) 100)) > (setq results (delq res results)))) > > - (when debbugs-show-progress > + (when (debbugs-show-progress) > (remove-function > (symbol-function debbugs-url-display-message-or-percentage-function) > "debbugs-url-display-message-or-percentage") > @@ -803,7 +808,7 @@ Examples: > > (let ((phrase (assq :phrase query)) > (debbugs-create-progress-reporter > - (and debbugs-show-progress (null debbugs-progress-reporter))) > + (and (debbugs-show-progress) (null debbugs-progress-reporter))) > (debbugs-progress-reporter debbugs-progress-reporter) > debbugs-progress-reporter-buffers url-show-status args result) > (when debbugs-create-progress-reporter