summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-search.el
diff options
context:
space:
mode:
authorEric Abrahamsen <eric@ericabrahamsen.net>2022-02-17 13:09:49 -0800
committerEric Abrahamsen <eric@ericabrahamsen.net>2022-02-17 13:11:25 -0800
commit246f627a4125d8b3ae5e88748a439f3f594340b5 (patch)
tree3a5b9586d115f794e6f3dd31a1c4b308e2565a67 /lisp/gnus/gnus-search.el
parent3d0f5bc219de43ebd1789882bad483720d581a4e (diff)
downloademacs-246f627a4125d8b3ae5e88748a439f3f594340b5.tar.gz
Fix gnus-search notmuch thread searches
* lisp/gnus/gnus-search.el (gnus-search-run-search): Multiple things wrong with collecting thread ids from the search results, and constructing a new search query. (gnus-search-indexed-search-command): Use list appending rather than backtick construction, that was more confusing than it was helpful.
Diffstat (limited to 'lisp/gnus/gnus-search.el')
-rw-r--r--lisp/gnus/gnus-search.el37
1 files changed, 22 insertions, 15 deletions
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 605d8a34e95..1e927ca9221 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -1634,13 +1634,20 @@ Namazu provides a little more information, for instance a score."
proc-buffer program cp-list))
(while (process-live-p proc)
(accept-process-output proc))
- (while (re-search-forward "^thread:\\([^ ]+\\)" (point-max) t)
- (push (match-string 1) thread-ids))
+ (goto-char (point-min))
+ (while (re-search-forward
+ "^thread:\\([^[:space:]\n]+\\)"
+ (point-max) t)
+ (cl-pushnew (match-string 1) thread-ids :test #'equal))
(cl-call-next-method
engine server
- ;; Completely replace the query with our new thread-based one.
- (mapconcat (lambda (thrd) (concat "thread:" thrd))
- thread-ids " or ")
+ ;; If we found threads, completely replace the query with
+ ;; our new thread-based one.
+ (if thread-ids
+ `((query . ,(mapconcat (lambda (thrd)
+ (concat "thread:" thrd))
+ thread-ids " or ")))
+ query)
nil)))
(cl-call-next-method engine server query groups)))
@@ -1653,16 +1660,16 @@ Namazu provides a little more information, for instance a score."
(let ((limit (alist-get 'limit query))
(thread (alist-get 'thread query)))
(with-slots (switches config-file) engine
- `(,(format "--config=%s" config-file)
- "search"
- ,(if thread
- "--output=threads"
- "--output=files")
- "--duplicate=1" ; I have found this necessary, I don't know why.
- ,@switches
- ,(if limit (format "--limit=%d" limit) "")
- ,qstring
- ))))
+ (append
+ (list (format "--config=%s" config-file)
+ "search"
+ (if thread
+ "--output=threads"
+ "--output=files"))
+ (unless thread '("--duplicate=1"))
+ (when limit (list (format "--limit=%d" limit)))
+ switches
+ (list qstring)))))
;;; Mairix interface