From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=DATE_IN_PAST_12_24, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31046 invoked from network); 24 Dec 2021 02:08:20 -0000 Received: from lists.gnu.org (209.51.188.17) by inbox.vuxu.org with ESMTPUTF8; 24 Dec 2021 02:08:20 -0000 Received: from localhost ([::1]:41046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0a0H-0002rt-Vz for ml@inbox.vuxu.org; Thu, 23 Dec 2021 21:08:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0a0F-0002rl-Cl for info-gnus-english@gnu.org; Thu, 23 Dec 2021 21:08:15 -0500 Received: from ciao.gmane.io ([116.202.254.214]:57426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0a0A-0008Md-DA for info-gnus-english@gnu.org; Thu, 23 Dec 2021 21:08:11 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1n0a06-0004fw-Qw for info-gnus-english@gnu.org; Fri, 24 Dec 2021 03:08:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: info-gnus-english@gnu.org From: "Jose A. Ortega Ruiz" Subject: Re: gnus-search-engine set to gnus-search-notmuch and refer threads Date: Thu, 23 Dec 2021 03:34:32 +0000 Message-ID: <87tuf08053.fsf@gnus.jao.io> References: <87lf1k11ed.fsf@onenetbeyond.org> <877dd4rmof.fsf@gnus.jao.io> <87wnk6q2ym.fsf@onenetbeyond.org> <87y24ebiw8.fsf@ust.hk> <87pmpoqrxz.fsf@gnus.jao.io> <87k0fw8hmn.fsf@ericabrahamsen.net> <87fsqk8hio.fsf@ericabrahamsen.net> <87zgos9rbv.fsf@gnus.jao.io> <87v8zg6u3r.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:gHskrGMK7kTGT8mlgPjH1+SIABs= X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: Received-SPF: pass client-ip=116.202.254.214; envelope-from=gegu-info-gnus-english@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_12_24=1.049, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+ml=inbox.vuxu.org@gnu.org Sender: "info-gnus-english" On Wed, Dec 22 2021, Eric Abrahamsen wrote: [...] > You have done heroic work, and I hope it may yet be unnecessary for me > to install and configure notmuch. Telling notmuch what to do with > "thread:xxx" queries is not difficult, and I should have a solution for > this in the next day or so. i fear you'll have to install it. the naive fixes below (properly set a query with (query . "thread:xxxxxxxxx") rather than the raw string, and eliminating --duplicate for thread searches) end up performing the query in nnselect group, rather than moving to the parent group. cheers, jao (cl-defmethod gnus-search-run-search :around ((engine gnus-search-notmuch) server query groups) "Handle notmuch's thread-search routine." ;; Notmuch allows for searching threads, but only using its own ;; thread ids. That means a thread search is a \"double-bounce\": ;; once to find the relevant thread ids, and again to find the ;; actual messages. This method performs the first \"bounce\". (if (alist-get 'thread query) (with-slots (program proc-buffer) engine (let* ((qstring (gnus-search-make-query-string engine query)) (cp-list (gnus-search-indexed-search-command engine qstring query groups)) thread-ids proc) (set-buffer proc-buffer) (erase-buffer) (setq proc (apply #'start-process (format "search-%s" server) proc-buffer program cp-list)) (while (process-live-p proc) (accept-process-output proc)) (goto-char (point-min)) (while (re-search-forward "^thread:\\([^\n ]+\\)" (point-max) t) (push (match-string 0) thread-ids)) (cl-call-next-method engine server ;; Completely replace the query with our new thread-based one. `((query . ,(mapconcat 'identity thread-ids " or "))) ;;;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ nil))) (cl-call-next-method engine server query groups))) (cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-notmuch) (qstring string) query &optional _groups) ;; Theoretically we could use the GROUPS parameter to pass a ;; --folder switch to notmuch, but I'm not confident of getting the ;; format right. (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") ,@(unless thread '("--duplicate=1")) ; I have found this necessary, I don't know why. ;;;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ,@switches ,(if limit (format "--limit=%d" limit) "") ,qstring ))))