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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1658 invoked from network); 18 Nov 2020 20:42:02 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 18 Nov 2020 20:42:02 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kfUFl-007GRE-P4; Wed, 18 Nov 2020 14:40:33 -0600 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94) (envelope-from ) id 1kfUFk-00BxNM-W5; Wed, 18 Nov 2020 14:40:33 -0600 Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kfUFg-00BxLf-7v for ding@lists.math.uh.edu; Wed, 18 Nov 2020 14:40:28 -0600 Received: from quimby.gnus.org ([95.216.78.240]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kfUFe-007GP1-7I for ding@lists.math.uh.edu; Wed, 18 Nov 2020 14:40:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HLbBcpSpBVI5jTiuHrscyqY9sGtOnk9eQOozJg+MULQ=; b=A9aSbthkW9bVUt2VZZoDaw9bUA 4QzM4F8NI4aCwM1mX2pzUJzHiKHPQTMS/Q9kQGHExkaTTdM+a2pIRF616Yo6VytWvebM8GNuJUqBH klgIuWJrBsDfc4usWzt9laiwE1R7fKGz71mN3NdAtu542EYFx9M7xqnY5aRoxhtlfMZ8=; Received: from ericabrahamsen.net ([52.70.2.18] helo=mail.ericabrahamsen.net) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfUFW-00081D-EL for ding@gnus.org; Wed, 18 Nov 2020 21:40:21 +0100 Received: from localhost (97-113-36-145.tukw.qwest.net [97.113.36.145]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 7A765FA02E; Wed, 18 Nov 2020 20:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1605732015; bh=HLbBcpSpBVI5jTiuHrscyqY9sGtOnk9eQOozJg+MULQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=MhTUPjF7Ci8K43Amw/0q+QWpGOBwZI9/8I8+uCe0OeLsDymRlA1MOAcfD0QyVeIKo 0K5UXSxE/NYP0YgNF57MB+39PSEXK0K1naujR8fvWynOr0kcZca7QOuS9NCgYphmZ0 dCXoMBeq/Ek+MJYsW8EEekt1S1ASQLVkCFt3/FBs= From: Eric Abrahamsen To: "Jose A. Ortega Ruiz" Cc: Eric S Fraga , ding@gnus.org Subject: Re: New "gnus-search" syntax and interface References: <87blgdavsb.fsf@ericabrahamsen.net> <877dqpikh5.fsf@ucl.ac.uk> <87sg9dctwu.fsf@hillenius.net> <87tuttfm20.fsf@ucl.ac.uk> <87ft5dgrm6.fsf@ericabrahamsen.net> <87361djiui.fsf@ucl.ac.uk> <877dqpgoky.fsf@ericabrahamsen.net> <87pn4hc97h.fsf@gnus.jao.io> <871rgtgxcn.fsf@ucl.ac.uk> <87k0ul2l62.fsf@ericabrahamsen.net> <874klodz20.fsf@ucl.ac.uk> <87lfezlemj.fsf@ericabrahamsen.net> <87lfezwkxt.fsf@gnus.jao.io> Date: Wed, 18 Nov 2020 12:40:05 -0800 In-Reply-To: <87lfezwkxt.fsf@gnus.jao.io> (Jose A. Ortega Ruiz's message of "Wed, 18 Nov 2020 00:46:54 +0000") Message-ID: <87a6vez9ei.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-ID: Precedence: bulk "Jose A. Ortega Ruiz" writes: > On Tue, Nov 17 2020, Eric Abrahamsen wrote: > >> Eric S Fraga writes: >> >>> On Monday, 16 Nov 2020 at 10:47, Eric Abrahamsen wrote: >>>> Well that's pretty weird. I didn't think I changed any of the actual >>>> parsing behavior, only reorganized code. >>> >>> With these complex systems, the whole concept of emergent behaviour >>> raises its head! ;-) >>> >>> Happy to test out anything you change etc., of course. >> >> Thanks very much. This is still baffling me. If you (and/or Jose, or >> anyone else) have a moment, would you please send me the command-line >> output of a successful notmuch search (ie absolute filenames) which >> fails in Emacs master right now? Feel free to anonymize however >> necessary, though obviously leaving the group-name part of the filepath >> alone. Plus whatever notmuch-related config you've got... > > If i perform a gnus-search for "baffled" in this group, which is called > by gnus "nntp:gmane.emacs.gnus.general", the buffer where > gnus-search-indexed-parse-output runs has the following output from > notmuch (which correctly inserts real path names): > > /home/jao/var/mail/gmane/emacs/gnus/general/65 > /home/jao/var/mail/feeds/news/cur/1605280382.M861830P724182.osgiliath,S=3292,W=3331:2,Sa > /home/jao/var/mail/gwene/org/arxiv/computer/science/1102 > > where /home/jao/var/mail is my remove-prefix. > > That method (gnus-search.el:1364) is receiving as its 'groups' argument > the value '("gmane.emacs.gnus.general"). the method constructs a regexp > that it calls group-regexp using that value, and that regexp is wrong. > > That is because it uses as its value: > > (when groups > (regexp-opt (mapcar (lambda (x) (gnus-group-real-name x)) groups))) > > which, for grous being '("gmane.emacs.gnus.general"), evaluates to: > > "\\(?:gmane\\.emacs\\.gnus\\.general\\)" > > That is wrong because the method then tries to match in the results > buffer, using that regexp, things like: > > /home/jao/var/mail/gmane.emacs.gnus.general/65 > > instead of correct pathnames such as: > > /home/jao/var/mail/gmane/emacs/gnus/general/65 > > The end result is that, despite notmuch finding correct paths and > inserting them correctly in the temporary results buffer, > gnus-search-indexed-parse-output fails to recognise them when it is > filtering those belonging to the searched for groups. And this is > because it's constructing a wrong regular expression in > gnus-search.el:1367, and using it in gnus-search.el:1381. > > The workaround my advice implements is changing the value of the input > parameter groups from '("foo.bar") to '("foo/bar"). > > I'm most probably belabouring here many things obvious to you, sorry > about that :) No, that's perfect, I'm trying to make completely sure I understand what's going on here. The original nnir-run-* functions all did pretty much the same thing but with slightly different code, and in combining all those functions I didn't get everything exactly in place. The original notmuch code used the GROUPS parameter to build a "--path" option for the notmuch call, but even if I re-instate that, we'll still want this filter here for the other engines. Would you try this version of the function? It should just permit any path separator when checking for group name matches. Thanks, Eric (cl-defmethod gnus-search-indexed-parse-output ((engine gnus-search-indexed) server query &optional groups) (let ((prefix (slot-value engine 'remove-prefix)) (group-regexp (when groups (mapconcat (lambda (x) (replace-regexp-in-string ;; Accept any of [.\/] as path separators. "[.\\/]" "[.\\\\/]" (gnus-group-real-name x))) groups "\\|"))) artlist vectors article group) (goto-char (point-min)) (while (not (eobp)) (pcase-let ((`(,f-name ,score) (gnus-search-indexed-extract engine))) (when (and (file-readable-p f-name) (null (file-directory-p f-name)) (or (null groups) (and (gnus-search-single-p query) (alist-get 'thread query)) (string-match-p group-regexp f-name))) (push (list f-name score) artlist)))) ;; Are we running an additional grep query? (when-let ((grep-reg (alist-get 'grep query))) (setq artlist (gnus-search-grep-search engine artlist grep-reg))) ;; Turn (file-name score) into [group article score]. (pcase-dolist (`(,f-name ,score) artlist) (setq article (file-name-nondirectory f-name)) ;; Remove prefix. (when (and prefix (file-name-absolute-p prefix) (string-match (concat "^" (file-name-as-directory prefix)) f-name)) (setq group (replace-match "" t t (file-name-directory f-name)))) ;; Break the directory name down until it's something that ;; (probably) can be used as a group name. (setq group (replace-regexp-in-string "[/\\]" "." (replace-regexp-in-string "/?\\(cur\\|new\\|tmp\\)?/\\'" "" (replace-regexp-in-string "^[./\\]" "" group nil t) nil t) nil t)) (push (vector (gnus-group-full-name group server) (if (string-match-p "\\`[[:digit:]]+\\'" article) (string-to-number article) (nnmaildir-base-name-to-article-number (substring article 0 (string-match ":" article)) group nil)) (if (numberp score) score (string-to-number score))) vectors)) vectors))