From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#37489: 27.0.50; Make `debbugs-gnu-search' work with `repeat-complex-command' Date: Mon, 23 Sep 2019 15:26:06 +0200 Message-ID: <87muevkutt.fsf@gmx.de> References: <87v9tjo7en.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="224339"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 37489@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 23 15:27:53 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iCONc-000wDs-6l for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Sep 2019 15:27:52 +0200 Original-Received: from localhost ([::1]:56544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCONa-0005A6-Ul for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Sep 2019 09:27:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57322) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCOMr-00054w-9v for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 09:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCOMp-0000lz-52 for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 09:27:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCOMo-0000ll-Sb for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 09:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iCOMo-0002UG-IN for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2019 09:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Sep 2019 13:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37489 X-GNU-PR-Package: emacs Original-Received: via spool by 37489-submit@debbugs.gnu.org id=B37489.15692451789472 (code B ref 37489); Mon, 23 Sep 2019 13:27:02 +0000 Original-Received: (at 37489) by debbugs.gnu.org; 23 Sep 2019 13:26:18 +0000 Original-Received: from localhost ([127.0.0.1]:35335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCOM5-0002Se-DA for submit@debbugs.gnu.org; Mon, 23 Sep 2019 09:26:18 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:60655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCOM3-0002SP-IJ for 37489@debbugs.gnu.org; Mon, 23 Sep 2019 09:26:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1569245167; bh=kQ0F6HCV+tYh819yLLgNOWOwwFVWWCCnu9hKsSCe9s8=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=OxXQWMxLq7RtYoYIIbcP+F3oN/Rlefh54h78sctYiPrtpHwH8FwPtn1NAJr3JV/YH VhLrc2p3LdVvqmfgb0wlaYCorS1d8tvEwGA4r84gRd6IZUPH9+h1kAoVMUrWngfjyQ Z1kfPNb+/nWM6IAVLVr1Y16mpnCxwGUyJP2QojbA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.91.242.124]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MqJqN-1hr81N3oCR-00nSj3; Mon, 23 Sep 2019 15:26:07 +0200 In-Reply-To: <87v9tjo7en.fsf@web.de> (Michael Heerdegen's message of "Mon, 23 Sep 2019 08:26:08 +0200") X-Provags-ID: V03:K1:+UM9IdljtkoSYdOltaGQigpJkEAfdL7hlIo8hN9y/fjDTVT/jAR EQk6xqQVb00azirHIxuJiP/RPo9xREk7PVe6FgYuqfOBszOjKT5uE3ZcvVHFEgSS9q4ntz+ ORCR/zcLcM1OyJmiWn0f+E2i71DR1wbFkuaYFVgyZX95yYdO1iR5GBLGTp0/iwAQkNGYvtq iJh25pGBUUX8RzA2Ol9Aw== X-UI-Out-Filterresults: notjunk:1;V03:K0:dOpt/HVcW3E=:xFHcD0JAVB+Ftzylueo05r nhQR0ACPq2dhBrDNNTu4//RFN2vFoid6QUtNzctJDxFX+W1KmTnVkmWABS/HNXVfJEwgUkBro tL4/Sk5FFI7sMcM+l7KtDveU7fxnYgxB7wk8Y2OUukJqEFNs/QNNCFEFd2N1w+tAZkuFkk5TQ EA3S/lLq0WODj4TJjfwhsOPAaU8OdKpEk3Z9qZCudVS7XRZ4NN+Tjr48gIN1CKlj3DB6lHhM4 yF/opxtb+CtS+kCj3YK6+y4jUojIYZYGGq4w9dPwxzAh9q1NuyUB6S/+QR36ucEa/Szs467zE DBHHVouorjbHwbMk7pHo7yQRSb3aCAlMDehgx2sTOtVbMkFxD09iIOD6x4FTfeXLIjWIQvKCF dkNvEUkEWJXO13yFB7Du3UDfQsMzUJYOxeQ0cOqR4si6+4OKJauHUV0J0jboiKJ2LinTsFgPm tdPh62qRj1c3jnCJt1U45Awb92/IQQAyGGLyPv9QGUSIbjUN4DhDGILqsT5iPzOoZ62IUkrQy Af6JInkuC+m2e2j1hYsgxzHEI18+y1xFIQRsiAUzDpBwyT+NDxYqoxUS5QIQPkgfJ9UOPCEG0 9f0Ir48MtlR2Wldmx+mAUoOOxrEQg/lSZT+w/xe9Xkdx39SlgOAdVsdeREpY63zMxLx5mXH5q xsSrWkA5l9k/0qNsrmjTfOq8yjBcgLDXfPHFhCvsWyLBGhVcK0y4b+8B+dbnNGKvvXGk0ycDG kF5uen80QQGr29mPcsFwcthSgQ4jnW4TwAJDQZzGRIVAmfXpctHgQWFFRE+aMU5deSboh7UP X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:166996 Archived-At: --=-=-= Content-Type: text/plain Michael Heerdegen writes: > Hi, Hi Michael, > when I want to repeat searching bugs with `debbugs-gnu-search' and a > similar query, I currently have to specify everything again. > `repeat-complex-command' is no help since the command currently has no > arguments. Could we please make it work with `repeat-complex-command'? > > The argument list of `debbugs-gnu-search' (currently empty) needs to > contain all information gathered, that seems to be the value of > `debbugs-gnu-current-query' and all arguments of the `debbugs-gnu' call. > > Then most of the current function body should be moved into the > interactive form. In the body only `debbugs-gnu-current-query' should > be let-bound to the first part of the function arguments, and > `debbugs-gnu' should be called with the rest. The appended patch shall do the job, you might test. However, I fear we will open a Pandora's box. We must set both debbugs-gnu-current-query and debbugs-gnu-current-filter, it depends on whether PHRASE is a string, or not. And even the allowed arguments in both cases are different. So it is very easy to make it wrong when editing the argument list. Even *I* would need to consult the implementation, in order to know what's allowed, and what's not. That's why the arguments were collected interactively only, so far. Anyway, I'm interested in your feedback whether that's the way to go. If yes, I would add some further sanity checks for QUERY, before callings debbugs-gnu. > TIA, > > Michael. Best regards, Michael. --=-=-= Content-Type: text/plain Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gn= u.el index 82dd582dc..f70becc27 100644 =2D-- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -417,172 +417,174 @@ be empty, in this case only the following attribut= es are used for search.")) ;;;###autoload -(defun debbugs-gnu-search () +(defun debbugs-gnu-search (phrase query severities packages archivedp) "Search for Emacs bugs interactively. Search arguments are requested interactively. The \"search phrase\" is used for full text search in the bugs database. Further key-value pairs are requested until an empty key is returned. If a key cannot be queried by a SOAP request, it is -marked as \"client-side filter\"." - (interactive) +marked as \"client-side filter\". - (unwind-protect - (let ((date-format - (eval-when-compile - (concat"\\([[:digit:]]\\{4\\}\\)-" - "\\([[:digit:]]\\{1,2\\}\\)-" - "\\([[:digit:]]\\{1,2\\}\\)"))) - key val1 val2 phrase severities packages archivedp) - - ;; Check for the phrase. - (setq phrase (read-string debbugs-gnu-phrase-prompt)) - (if (zerop (length phrase)) - (setq phrase nil) - (add-to-list 'debbugs-gnu-current-query (cons 'phrase phrase))) - ;; We suppress closed bugs if there is no phrase. - (setq debbugs-gnu-current-suppress - (if (not debbugs-gnu-suppress-closed) - nil - (null phrase))) - - ;; The other queries. - (catch :finished - (while t - (setq key (completing-read - "Enter attribute: " - (if phrase - (append - '("severity" "package" "tags" - "author" "date" "subject") - ;; Client-side filters. - (mapcar - (lambda (key) - (propertize - key 'face 'debbugs-gnu-done - 'help-echo "Client-side filter")) - '("status"))) - (append - '("severity" "package" "archive" "src" "status" "tag" - "owner" "submitter" "maint" "correspondent") - ;; Client-side filters. - (mapcar - (lambda (key) - (propertize - key 'face 'debbugs-gnu-done - 'help-echo "Client-side filter")) - '("date" "log_modified" "last_modified" - "found_date" "fixed_date" "unarchived" - "subject" "done" "forwarded" "msgid" "summary")))) - nil t)) - (cond - ;; Server-side queries. - ((equal key "severity") - (setq - severities - (completing-read-multiple - "Enter severities: " debbugs-gnu-all-severities nil t - (mapconcat #'identity debbugs-gnu-default-severities ",")))) - - ((equal key "package") - (setq - packages - (completing-read-multiple - "Enter packages: " debbugs-gnu-all-packages nil t - (mapconcat #'identity debbugs-gnu-default-packages ",")))) - - ((equal key "archive") - ;; We simplify, by assuming just archived bugs are requested. - (setq archivedp t)) - - ((member key '("src" "tag" "tags")) - (setq val1 (read-string (format "Enter %s: " key))) - (when (not (zerop (length val1))) - (add-to-list - 'debbugs-gnu-current-query (cons (intern key) val1)))) - - ((member - key '("author" "owner" "submitter" "maint" "correspondent")) - (setq val1 (read-string "Enter email address: ")) - (when (not (zerop (length val1))) - (add-to-list - 'debbugs-gnu-current-query - (cons (intern (if (equal key "author") "@author" key)) val1)))) - - ;; Client-side filters. - ((equal key "status") - (setq - val1 - (completing-read - (format "Enter status%s: " - (if (null phrase) "" " (client-side filter)")) - '("open" "forwarded" "done") nil t)) - (when (not (zerop (length val1))) - (if (null phrase) - (add-to-list - 'debbugs-gnu-current-query (cons (intern key) val1)) - (add-to-list - 'debbugs-gnu-current-filter (cons 'pending val1))))) - - ((member key '("date" "log_modified" "last_modified" - "found_date" "fixed_date" "unarchived")) - (setq val1 - (debbugs-gnu-calendar-read - (format "Enter %s before YYYY-MM-DD%s: " - key (if phrase "" " (client-side filter)")) - (lambda (x) - (string-match (concat "^\\(" date-format "\\|\\)$") x)))) - (if (string-match date-format val1) - (setq val1 (floor - (float-time - (encode-time - 0 0 0 - (string-to-number (match-string 3 val1)) - (string-to-number (match-string 2 val1)) - (string-to-number (match-string 1 val1)))))) - (setq val1 nil)) - (setq val2 - (debbugs-gnu-calendar-read - (format "Enter %s after YYYY-MM-DD%s: " - key (if phrase "" " (client-side filter)")) - (lambda (x) - (string-match (concat "^\\(" date-format "\\|\\)$") x)))) - (if (string-match date-format val2) - (setq val2 (floor - (float-time - (encode-time - 0 0 0 - (string-to-number (match-string 3 val2)) - (string-to-number (match-string 2 val2)) - (string-to-number (match-string 1 val2)))))) - (setq val2 nil)) - (when (or val1 val2) - (add-to-list - (if phrase - 'debbugs-gnu-current-query 'debbugs-gnu-current-filter) - (cons (intern - (if (and phrase (equal key "date")) "@cdate" key)) - (cons val1 val2))))) - - ;; "subject", "done", "forwarded", "msgid", "summary". - ((not (zerop (length key))) - (setq val1 - (funcall - (if phrase 'read-string 'read-regexp) - (format "Enter %s%s: " - key (if phrase "" " (client-side filter)")))) - (when (not (zerop (length val1))) - (add-to-list - (if phrase - 'debbugs-gnu-current-query 'debbugs-gnu-current-filter) - (cons (intern key) val1)))) - - ;; The End. - (t (throw :finished nil))))) - - ;; Do the search. - (debbugs-gnu severities packages archivedp) - (when (called-interactively-p 'interactive) - (message "Search finished"))))) +When using interactively, use \\[repeat-complex-command] after +this command for reusing the argument list. Be careful in +editing the arguments, because the allowed attributes for QUERY +depend on PHRASE being a string, or nil." + (interactive + (let ((date-format + (eval-when-compile + (concat"\\([[:digit:]]\\{4\\}\\)-" + "\\([[:digit:]]\\{1,2\\}\\)-" + "\\([[:digit:]]\\{1,2\\}\\)"))) + key val1 val2 phrase query severities packages archivedp) + + ;; Check for the phrase. + (setq phrase (read-string debbugs-gnu-phrase-prompt)) + (when (zerop (length phrase)) + (setq phrase nil)) + + ;; The other queries. + (catch :finished + (while t + (setq key (completing-read + "Enter attribute: " + (if phrase + (append + '("severity" "package" "tags" + "author" "date" "subject") + ;; Client-side filters. + (mapcar + (lambda (key) + (propertize + key 'face 'debbugs-gnu-done + 'help-echo "Client-side filter")) + '("status"))) + (append + '("severity" "package" "archive" "src" "status" "tag" + "owner" "submitter" "maint" "correspondent") + ;; Client-side filters. + (mapcar + (lambda (key) + (propertize + key 'face 'debbugs-gnu-done + 'help-echo "Client-side filter")) + '("date" "log_modified" "last_modified" + "found_date" "fixed_date" "unarchived" + "subject" "done" "forwarded" "msgid" "summary")))) + nil t)) + (cond + ;; Server-side queries. + ((equal key "severity") + (setq + severities + (completing-read-multiple + "Enter severities: " debbugs-gnu-all-severities nil t + (mapconcat #'identity debbugs-gnu-default-severities ",")))) + + ((equal key "package") + (setq + packages + (completing-read-multiple + "Enter packages: " debbugs-gnu-all-packages nil t + (mapconcat #'identity debbugs-gnu-default-packages ",")))) + + ((equal key "archive") + ;; We simplify, by assuming just archived bugs are requested. + (setq archivedp t)) + + ((member key '("src" "tag" "tags")) + (setq val1 (read-string (format "Enter %s: " key))) + (when (not (zerop (length val1))) + (push (cons (intern key) val1) query))) + + ((member + key '("author" "owner" "submitter" "maint" "correspondent")) + (setq val1 (read-string "Enter email address: ")) + (when (not (zerop (length val1))) + (push + (cons (intern (if (equal key "author") "@author" key)) val1) + query))) + + ;; Client-side filters. + ((equal key "status") + (setq + val1 + (completing-read + (format "Enter status%s: " + (if (null phrase) "" " (client-side filter)")) + '("open" "forwarded" "done") nil t)) + (when (not (zerop (length val1))) + (push (cons (if (null phrase) (intern key) 'pending) val1) query))) + + ((member key '("date" "log_modified" "last_modified" + "found_date" "fixed_date" "unarchived")) + (setq val1 + (debbugs-gnu-calendar-read + (format "Enter %s before YYYY-MM-DD%s: " + key (if phrase "" " (client-side filter)")) + (lambda (x) + (string-match (concat "^\\(" date-format "\\|\\)$") x)))) + (if (string-match date-format val1) + (setq val1 (floor + (float-time + (encode-time + 0 0 0 + (string-to-number (match-string 3 val1)) + (string-to-number (match-string 2 val1)) + (string-to-number (match-string 1 val1)))))) + (setq val1 nil)) + (setq val2 + (debbugs-gnu-calendar-read + (format "Enter %s after YYYY-MM-DD%s: " + key (if phrase "" " (client-side filter)")) + (lambda (x) + (string-match (concat "^\\(" date-format "\\|\\)$") x)))) + (if (string-match date-format val2) + (setq val2 (floor + (float-time + (encode-time + 0 0 0 + (string-to-number (match-string 3 val2)) + (string-to-number (match-string 2 val2)) + (string-to-number (match-string 1 val2)))))) + (setq val2 nil)) + (when (or val1 val2) + (push + (cons (intern (if (and phrase (equal key "date")) "@cdate" key)) + (cons val1 val2)) + query))) + + ;; "subject", "done", "forwarded", "msgid", "summary". + ((not (zerop (length key))) + (setq val1 + (funcall + (if phrase 'read-string 'read-regexp) + (format "Enter %s%s: " + key (if phrase "" " (client-side filter)")))) + (when (not (zerop (length val1))) + (push (cons (intern key) val1) query))) + + ;; The End. + (t (throw :finished nil))))) + + ;; The arguments. + (list phrase query severities packages archivedp))) + + + ;; We suppress closed bugs if there is no phrase. + (setq debbugs-gnu-current-suppress + (if (not debbugs-gnu-suppress-closed) + nil + (null phrase))) + + ;; Set phrase and query. + (if phrase + (setq debbugs-gnu-current-query + (append (list (cons 'phrase phrase)) query)) + (setq debbugs-gnu-current-filter query)) + + ;; Do the search. + (debbugs-gnu severities packages archivedp) + (message "Search finished")) ;;;###autoload (defun debbugs-gnu-patches () --=-=-=--