emacs-diffs
[Top][All Lists]
Advanced

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

master 246f627a41: Fix gnus-search notmuch thread searches


From: Eric Abrahamsen
Subject: master 246f627a41: Fix gnus-search notmuch thread searches
Date: Thu, 17 Feb 2022 16:11:37 -0500 (EST)

branch: master
commit 246f627a4125d8b3ae5e88748a439f3f594340b5
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    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.
---
 lisp/gnus/gnus-search.el | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 605d8a34e9..1e927ca922 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
 



reply via email to

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