branch: externals/debbugs commit d48e354d586fd6b9f59c7bf0fa303b597ab9a469 Author: Michael Albinus <michael.albi...@gmx.de> Commit: Michael Albinus <michael.albi...@gmx.de>
Improve handling of skip and max in searching * debbugs-gnu.el (debbugs-gnu-search, debbugs-gnu-get-bugs): Handle `skip' and `max' properly. * debbugs-ug.texi (Searching Bugs): Describe skip and max. --- debbugs-gnu.el | 35 ++++++++++++++++++----------------- debbugs-ug.texi | 12 ++++++------ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/debbugs-gnu.el b/debbugs-gnu.el index 8f71c853ea..744ec0bc9c 100644 --- a/debbugs-gnu.el +++ b/debbugs-gnu.el @@ -526,13 +526,13 @@ depend on PHRASE being a string, or nil. See Info node (interactive (let ((date-format (eval-when-compile - (concat"\\([[:digit:]]\\{4\\}\\)-" - "\\([[:digit:]]\\{1,2\\}\\)-" - "\\([[:digit:]]\\{1,2\\}\\)"))) + (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)) + (setq phrase (string-trim (read-string debbugs-gnu-phrase-prompt))) (when (zerop (length phrase)) (setq phrase nil)) @@ -544,7 +544,8 @@ depend on PHRASE being a string, or nil. See Info node (if phrase (append '("severity" "package" "tags" - "author" "date" "subject") + "author" "date" "subject" + "skip" "max") ;; Client-side filters. (mapcar (lambda (key) @@ -598,6 +599,11 @@ depend on PHRASE being a string, or nil. See Info node (cons (intern (if (equal key "author") "@author" key)) val1) query))) + ((member key '("skip" "max")) + (setq val1 (read-number (format "Enter %s: " key))) + (when (natnump val1) + (push (cons (intern key) val1) query))) + ;; Client-side filters. ((equal key "status") (setq @@ -940,8 +946,12 @@ This function assumes the variable `user-mail-address' is defined." (tags (and (member '(severity . "tagged") query) (assq 'tag query))) (local-tags (and (member '(severity . "tagged") query) (not tags))) (phrase (assq 'phrase query)) + (skip (assq 'skip query)) + (max (assq 'max query)) args) ;; Compile query arguments. + (setq query (delete skip query) + query (delete max query)) (unless (or query tags) (dolist (elt debbugs-gnu-default-packages) (setq args (append args (list :package elt))))) @@ -953,18 +963,9 @@ This function assumes the variable `user-mail-address' is defined." (if phrase (cond ((eq (car elt) 'phrase) - (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)))) + (list (append (list :phrase (cdr phrase)) + (when skip (list :skip (cdr skip))) + (when max (list :max (cdr max)))))) ((memq (car elt) '(date @cdate)) (list (list (intern (concat ":" (symbol-name (car elt)))) (cddr elt) (cadr elt) diff --git a/debbugs-ug.texi b/debbugs-ug.texi index ee7ede19e1..5dc6ccbfc9 100644 --- a/debbugs-ug.texi +++ b/debbugs-ug.texi @@ -333,12 +333,6 @@ Several wildcards must be separated by the operators explained above. While the words to be searched for are case insensitive, the operators must be specified in upper case. -@ignore -For test purposes, we have added the operators "MAX <nnn>" and "SKIP -<nnn>" at the end of a phrase. Since this is internal only, we don't -document it here. -@end ignore - While the search for the phrase is performed only in the bodies of the messages belonging to a bug report, it is also possible to restrict the search using further bug attributes. The commands ask for such @@ -346,6 +340,12 @@ attribute-value pairs, until an empty attribute is returned. Possible attributes are @table @samp +@item skip +How many hits are skipped (default 0). + +@item max +How many maximal hits are returned. + @item severity A comma-separated list of bug severities, @xref{Retrieving Bugs}.