From unknown Mon Aug 18 08:27:32 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#33122 <33122@debbugs.gnu.org> To: bug#33122 <33122@debbugs.gnu.org> Subject: Status: 27.0.50; Allow use of Gnus search groups as notmuch :path search terms Reply-To: bug#33122 <33122@debbugs.gnu.org> Date: Mon, 18 Aug 2025 15:27:32 +0000 retitle 33122 27.0.50; Allow use of Gnus search groups as notmuch :path sea= rch terms reassign 33122 emacs submitter 33122 Eric Abrahamsen severity 33122 normal tag 33122 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 22 22:57:21 2018 Received: (at submit) by debbugs.gnu.org; 23 Oct 2018 02:57:21 +0000 Received: from localhost ([127.0.0.1]:36877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEmsi-0005hf-Oi for submit@debbugs.gnu.org; Mon, 22 Oct 2018 22:57:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEmsg-0005hR-Dx for submit@debbugs.gnu.org; Mon, 22 Oct 2018 22:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEmsa-0007BG-25 for submit@debbugs.gnu.org; Mon, 22 Oct 2018 22:57:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEmsZ-0007B2-MD for submit@debbugs.gnu.org; Mon, 22 Oct 2018 22:57:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEmsY-00076T-HE for bug-gnu-emacs@gnu.org; Mon, 22 Oct 2018 22:57:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEmsV-00079M-9W for bug-gnu-emacs@gnu.org; Mon, 22 Oct 2018 22:57:10 -0400 Received: from mail.ericabrahamsen.net ([50.56.99.223]:38871) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEmsQ-00072S-Ee for bug-gnu-emacs@gnu.org; Mon, 22 Oct 2018 22:57:04 -0400 Received: from localhost (unknown [123.119.252.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 205F540D74 for ; Tue, 23 Oct 2018 02:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1540263414; bh=Yv8NGwFa1sW5MYzh8XZPDDra6SXfFYZ8yLvSI9wUVtQ=; h=From:To:Subject:Date:From; b=uOro95VgJ9L9Z1jYVfrvNTA2E31dkHwHxpXl0ffzASA+NjwmVWPT8tArVRAbO1UJG XGZ49smfoKXAkbLkzKU6HUMx48Gg4ckzKh9gMP4MSZXjSDUxtmmvh6thl/zWT3KV98 XnrW1JAuvCVnNUykaDbCMX2HgiS7z+HinvIoeM3s= From: Eric Abrahamsen To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Allow use of Gnus search groups as notmuch :path search terms Date: Tue, 23 Oct 2018 10:56:47 +0800 Message-ID: <871s8hfk0g.fsf@ericabrahamsen.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) --=-=-= Content-Type: text/plain Searches in Gnus are always conducted on one or more groups. Right now, using the notmuch search engine, it's not possible to turn those groups into path: search terms in the notmuch query, though that's clearly the sensible thing to do (it looks like rudimentary support for path filtering was halfway added, but not quite). This patch creates a new `nnir-notmuch-filter-group-names-function' custom option which transforms group names into something notmuch is likely to understand. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-use-of-Gnus-search-groups-as-notmuch-path-sear.patch >From 4274d95d3eece4a58b1f712fbacb3a3baaab2986 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 23 Oct 2018 10:51:37 +0800 Subject: [PATCH] Allow use of Gnus search groups as notmuch path: search term * lisp/gnus/nnir.el (nnir-notmuch-filter-group-names-function): New option governing whether and how to use Gnus' search groups as path: search terms to notmuch. (nnir-run-notmuch): Check and possibly use above variable. --- lisp/gnus/nnir.el | 56 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 7e5f56e4dd..251e54e015 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -518,6 +518,26 @@ nnir-notmuch-remove-prefix :type '(regexp) :group 'nnir) +(defcustom nnir-notmuch-filter-group-names-function + (lambda (g) (gnus-group-short-name g)) + "Whether and how to use Gnus group names as \"path:\" search terms. +When nil, the groups being searched in are not used as notmuch +:path search terms. It's still possible to use \"path:\" terms +manually within the search query, however. + +When a function, map this function over all the group names. By +default this runs them through `gnus-group-short-name', and it is +recommended to use this transform, at least. Further +transforms (for instance, converting \".\" to \"/\") can be +added like so: + +\(add-function :filter-return + nnir-notmuch-filter-group-names-function + (lambda (g) (replace-regexp-in-string \"\\\\.\" \"/\" g)))" + :version "27.1" + :type '(choice function + nil)) + ;;; Developer Extension Variable: (defvar nnir-engines @@ -1505,23 +1525,28 @@ nnir-run-namazu (> (nnir-artitem-rsv x) (nnir-artitem-rsv y))))))))) -(defun nnir-run-notmuch (query server &optional _group) +(defun nnir-run-notmuch (query server &optional groups) "Run QUERY against notmuch. Returns a vector of (group name, file name) pairs (also vectors, -actually)." - - ;; (when group - ;; (error "The notmuch backend cannot search specific groups")) +actually). If GROUPS is a list of group names, use them to +construct path: search terms (see the variable +`nnir-notmuch-filter-group-names-function')." (save-excursion - (let ( (qstring (cdr (assq 'query query))) - (groupspec (cdr (assq 'notmuch-group query))) + (let* ((qstring (cdr (assq 'query query))) (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server)) artlist (article-pattern (if (string-match "\\`nnmaildir:" (gnus-group-server server)) - ":[0-9]+" - "^[0-9]+$")) + ":[0-9]+" + "^[0-9]+$")) + (groups (when nnir-notmuch-filter-group-names-function + (mapcar nnir-notmuch-filter-group-names-function + groups))) + (pathquery (when groups + (mapconcat (lambda (g) + (format " path:%s" g)) + groups " or"))) artno dirnam filenam) (when (equal "" qstring) @@ -1530,10 +1555,14 @@ nnir-run-notmuch (set-buffer (get-buffer-create nnir-tmp-buffer)) (erase-buffer) - (if groupspec - (message "Doing notmuch query %s on %s..." qstring groupspec) + (if groups + (message "Doing notmuch query %s on %s..." + qstring (mapconcat #'identity groups " ")) (message "Doing notmuch query %s..." qstring)) + (when groups + (setq qstring (concat qstring pathquery))) + (let* ((cp-list `( ,nnir-notmuch-program nil ; input from /dev/null t ; output @@ -1571,10 +1600,7 @@ nnir-run-notmuch (when (string-match article-pattern artno) (when (not (null dirnam)) - ;; maybe limit results to matching groups. - (when (or (not groupspec) - (string-match groupspec dirnam)) - (nnir-add-result dirnam artno "" prefix server artlist))))) + (nnir-add-result dirnam artno "" prefix server artlist)))) (message "Massaging notmuch output...done") -- 2.19.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 22 23:02:54 2018 Received: (at control) by debbugs.gnu.org; 23 Oct 2018 03:02:54 +0000 Received: from localhost ([127.0.0.1]:36882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEmy6-0007pf-Ge for submit@debbugs.gnu.org; Mon, 22 Oct 2018 23:02:54 -0400 Received: from mail.ericabrahamsen.net ([50.56.99.223]:39369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEmy5-0007p4-JN for control@debbugs.gnu.org; Mon, 22 Oct 2018 23:02:53 -0400 Received: from localhost (unknown [123.119.252.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 75E4844335 for ; Tue, 23 Oct 2018 03:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1540263773; bh=wwdMmOEVvzFu6mpQdb1tTjIda/AMNU/HSBQdRA1mjtI=; h=From:To:Subject:References:Date:In-Reply-To:From; b=AGMvfeBGOk4trdiis5ZZfoMhtdS7mtQJPAIksuVnpjMNldUeph3oHHY0wopzPmA5T J91RsfzWGQ6Hxhlrz/4o+jclbOcjuYLqZd3ze+woKfptMQn2WmILvklEGDb7706YZf YFtl1bn8R6l6Y1Og9T6ws9VygY9OuBmpqcz7YOWo= From: Eric Abrahamsen To: Debbugs control Subject: Re: bug#33122: Acknowledgement (27.0.50; Allow use of Gnus search groups as notmuch :path search terms) References: <871s8hfk0g.fsf@ericabrahamsen.net> Date: Tue, 23 Oct 2018 11:02:49 +0800 In-Reply-To: (GNU bug Tracking System's message of "Tue, 23 Oct 2018 02:58:02 +0000") Message-ID: <87r2ghe55y.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 33122 patch From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 23 20:46:47 2018 Received: (at 33122) by debbugs.gnu.org; 24 Oct 2018 00:46:48 +0000 Received: from localhost ([127.0.0.1]:38957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gF7Jv-0005ri-Kc for submit@debbugs.gnu.org; Tue, 23 Oct 2018 20:46:47 -0400 Received: from mail.ericabrahamsen.net ([50.56.99.223]:54031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gF7Jt-0005rZ-Be for 33122@debbugs.gnu.org; Tue, 23 Oct 2018 20:46:45 -0400 Received: from localhost (unknown [123.116.140.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 791813F8B1 for <33122@debbugs.gnu.org>; Wed, 24 Oct 2018 00:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1540342004; bh=K7wip/JHnDkO+Su4G/AGiyMcUcyrLwPZ4ylwzjR/G+g=; h=From:To:Subject:In-Reply-To:References:Date:From; b=PKLImOj/yzfOPuBGeguC5AI8XgXwAuISkfV24nAGrIJ7ZCrjk4DGGJKWJNcqSXLhu Cntb3Pk/6i6nLNlZcnVJdrCp8e0NCItR6ixXwFm0mlqW8BiZESws4P2zwUNUtAjs+U spVA5fL4J6KO8i5ShaCk8SnvymdapAmb6HLZgZ6Q= From: Eric Abrahamsen To: 33122@debbugs.gnu.org Subject: Re: bug#33122: Acknowledgement (27.0.50; Allow use of Gnus search groups as notmuch :path search terms) In-Reply-To: (GNU bug Tracking System's message of "Tue, 23 Oct 2018 02:58:02 +0000") References: <871s8hfk0g.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Wed, 24 Oct 2018 08:46:29 +0800 Message-ID: <875zxscgt6.fsf@ericabrahamsen.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33122 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Here's an updated version of the patch, thanks to Andreas Goesele for reporting and testing. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-use-of-Gnus-search-groups-as-notmuch-path-sear.patch >From 517ca66601e97babeda7a20150bee24df9c9975b Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 23 Oct 2018 10:51:37 +0800 Subject: [PATCH] Allow use of Gnus search groups as notmuch path: search term * lisp/gnus/nnir.el (nnir-notmuch-filter-group-names-function): New option governing whether and how to use Gnus' search groups as path: search terms to notmuch. (nnir-run-notmuch): Check and possibly use above variable. --- lisp/gnus/nnir.el | 58 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 7e5f56e4dd..ea7257d0c9 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -518,6 +518,26 @@ nnir-notmuch-remove-prefix :type '(regexp) :group 'nnir) +(defcustom nnir-notmuch-filter-group-names-function + #'gnus-group-short-name + "Whether and how to use Gnus group names as \"path:\" search terms. +When nil, the groups being searched in are not used as notmuch +:path search terms. It's still possible to use \"path:\" terms +manually within the search query, however. + +When a function, map this function over all the group names. By +default this runs them through `gnus-group-short-name', and it is +recommended to use this transform, at least. Further +transforms (for instance, converting \".\" to \"/\") can be +added like so: + +\(add-function :filter-return + nnir-notmuch-filter-group-names-function + (lambda (g) (replace-regexp-in-string \"\\\\.\" \"/\" g)))" + :version "27.1" + :type '(choice function + nil)) + ;;; Developer Extension Variable: (defvar nnir-engines @@ -1505,23 +1525,30 @@ nnir-run-namazu (> (nnir-artitem-rsv x) (nnir-artitem-rsv y))))))))) -(defun nnir-run-notmuch (query server &optional _group) +(defun nnir-run-notmuch (query server &optional groups) "Run QUERY against notmuch. Returns a vector of (group name, file name) pairs (also vectors, -actually)." - - ;; (when group - ;; (error "The notmuch backend cannot search specific groups")) +actually). If GROUPS is a list of group names, use them to +construct path: search terms (see the variable +`nnir-notmuch-filter-group-names-function')." (save-excursion - (let ( (qstring (cdr (assq 'query query))) - (groupspec (cdr (assq 'notmuch-group query))) + (let* ((qstring (cdr (assq 'query query))) (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server)) artlist (article-pattern (if (string-match "\\`nnmaildir:" (gnus-group-server server)) - ":[0-9]+" - "^[0-9]+$")) + ":[0-9]+" + "^[0-9]+$")) + (groups (when nnir-notmuch-filter-group-names-function + (mapcar nnir-notmuch-filter-group-names-function + groups))) + (pathquery (when groups + (concat "(" + (mapconcat (lambda (g) + (format " path:%s" g)) + groups " or") + ")"))) artno dirnam filenam) (when (equal "" qstring) @@ -1530,10 +1557,14 @@ nnir-run-notmuch (set-buffer (get-buffer-create nnir-tmp-buffer)) (erase-buffer) - (if groupspec - (message "Doing notmuch query %s on %s..." qstring groupspec) + (if groups + (message "Doing notmuch query %s on %s..." + qstring (mapconcat #'identity groups " ")) (message "Doing notmuch query %s..." qstring)) + (when groups + (setq qstring (concat qstring pathquery))) + (let* ((cp-list `( ,nnir-notmuch-program nil ; input from /dev/null t ; output @@ -1571,10 +1602,7 @@ nnir-run-notmuch (when (string-match article-pattern artno) (when (not (null dirnam)) - ;; maybe limit results to matching groups. - (when (or (not groupspec) - (string-match groupspec dirnam)) - (nnir-add-result dirnam artno "" prefix server artlist))))) + (nnir-add-result dirnam artno "" prefix server artlist)))) (message "Massaging notmuch output...done") -- 2.19.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 03 04:43:58 2018 Received: (at 33122-done) by debbugs.gnu.org; 3 Nov 2018 08:43:59 +0000 Received: from localhost ([127.0.0.1]:60577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gIrXC-0007Aa-N8 for submit@debbugs.gnu.org; Sat, 03 Nov 2018 04:43:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gIrXB-0007AN-LW for 33122-done@debbugs.gnu.org; Sat, 03 Nov 2018 04:43:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIrWy-0008Ta-UL for 33122-done@debbugs.gnu.org; Sat, 03 Nov 2018 04:43:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIrWy-0008Rl-Dj; Sat, 03 Nov 2018 04:43:44 -0400 Received: from [176.228.60.248] (port=2066 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gIrWx-0000SL-EW; Sat, 03 Nov 2018 04:43:44 -0400 Date: Sat, 03 Nov 2018 10:43:34 +0200 Message-Id: <83h8gyft55.fsf@gnu.org> From: Eli Zaretskii To: Eric Abrahamsen In-reply-to: <875zxscgt6.fsf@ericabrahamsen.net> (message from Eric Abrahamsen on Wed, 24 Oct 2018 08:46:29 +0800) Subject: Re: bug#33122: Acknowledgement (27.0.50; Allow use of Gnus search groups as notmuch :path search terms) References: <871s8hfk0g.fsf@ericabrahamsen.net> <875zxscgt6.fsf@ericabrahamsen.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 33122-done Cc: 33122-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Eric Abrahamsen > Date: Wed, 24 Oct 2018 08:46:29 +0800 > > Here's an updated version of the patch, thanks to Andreas Goesele for > reporting and testing. Thanks, pushed to the master branch. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 19 13:17:27 2018 Received: (at 33122) by debbugs.gnu.org; 19 Nov 2018 18:17:27 +0000 Received: from localhost ([127.0.0.1]:32984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOo6w-00025s-Ta for submit@debbugs.gnu.org; Mon, 19 Nov 2018 13:17:27 -0500 Received: from mail.ericabrahamsen.net ([50.56.99.223]:34619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOo6w-00025l-1M for 33122@debbugs.gnu.org; Mon, 19 Nov 2018 13:17:26 -0500 Received: from localhost (71-212-20-199.tukw.qwest.net [71.212.20.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 2A18A3F0C9; Mon, 19 Nov 2018 18:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1542651445; bh=K9CeyZFbXJ/vCpMuw2IRVHvJ2gEKwBgz+6L7zOQGXjk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=fPY6fYYjdrjPDFPx8TjJlFPINfifVOECMQHSyuzDk2DVa8vVOhKP6L59+St7+edvv HFuoG7WGlAZjRdYKL4Wo/tg3FyzKg5hIAQgWn+Msty9hSUlXJ85YAIISTDMLKTN7Cd OXhzQQsTcs8X8BmZ/41tYFl+h3nUefP1ZA5xUeGM= From: Eric Abrahamsen To: Eli Zaretskii Subject: Re: bug#33122: Acknowledgement (27.0.50; Allow use of Gnus search groups as notmuch :path search terms) References: <871s8hfk0g.fsf@ericabrahamsen.net> <875zxscgt6.fsf@ericabrahamsen.net> <83h8gyft55.fsf@gnu.org> Date: Mon, 19 Nov 2018 10:17:24 -0800 In-Reply-To: <83h8gyft55.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Nov 2018 10:43:34 +0200") Message-ID: <87bm6l9bkb.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33122 Cc: 33122@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain On 11/03/18 10:43 AM, Eli Zaretskii wrote: >> From: Eric Abrahamsen >> Date: Wed, 24 Oct 2018 08:46:29 +0800 >> >> Here's an updated version of the patch, thanks to Andreas Goesele for >> reporting and testing. > > Thanks, pushed to the master branch. In hindsight, this behavior should be off by default: it's going to require user intervention too often to be practical as on-by-default. This patch changes that, fixes a small bug, and also documents the option. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-Allow-use-of-Gnus-search-groups-as-notmuch-path-.patch >From 7c26e8db58f64446f60c6f255a1a614deba198a6 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Mon, 19 Nov 2018 10:03:16 -0800 Subject: [PATCH] Fix "Allow use of Gnus search groups as notmuch path: search term" * lisp/gnus/nnir.el (nnir-notmuch-filter-group-names-function): Default to nil -- getting correct behavior requires user intervention too often to have this enabled by default. * lisp/gnus/nnir.el (nnir-run-notmuch): If the user has turned this on, then also hardcode `gnus-group-short-name' as a filter -- things will never work without it. Also move leading space to before the opening parenthesis. * doc/misc/gnus.texi: Document option. (Bug#33122) --- doc/misc/gnus.texi | 12 ++++++++++++ lisp/gnus/nnir.el | 27 +++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index fb9113f460..d1c746c2e5 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -21468,6 +21468,18 @@ The notmuch Engine to get a group name (albeit with @samp{/} instead of @samp{.}). This is a regular expression. +@item nnir-notmuch-filter-group-names-function +A function used to transform the names of groups being searched in, +for use as a ``path:'' search keyword for notmuch. If nil, the +default, ``path:'' keywords are not used. Otherwise, this should be a +callable which accepts a single group name and returns a transformed +name as notmuch expects to see it. In many mail backends, for +instance, dots in group names must be converted to forward slashes: to +achieve this, set this option to +@example +(lambda (g) (replace-regexp-in-string "\\." "/" g)) +@end example + @end table diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index ea7257d0c9..084b154e8a 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -518,18 +518,16 @@ nnir-notmuch-remove-prefix :type '(regexp) :group 'nnir) -(defcustom nnir-notmuch-filter-group-names-function - #'gnus-group-short-name +(defcustom nnir-notmuch-filter-group-names-function nil "Whether and how to use Gnus group names as \"path:\" search terms. When nil, the groups being searched in are not used as notmuch :path search terms. It's still possible to use \"path:\" terms manually within the search query, however. -When a function, map this function over all the group names. By -default this runs them through `gnus-group-short-name', and it is -recommended to use this transform, at least. Further -transforms (for instance, converting \".\" to \"/\") can be -added like so: +When a function, map this function over all the group names. To +use the group names unchanged, set to (lambda (g) g). Multiple +transforms (for instance, converting \".\" to \"/\") can be added +like so: \(add-function :filter-return nnir-notmuch-filter-group-names-function @@ -1541,14 +1539,15 @@ nnir-run-notmuch ":[0-9]+" "^[0-9]+$")) (groups (when nnir-notmuch-filter-group-names-function - (mapcar nnir-notmuch-filter-group-names-function - groups))) + (delq nil + (mapcar nnir-notmuch-filter-group-names-function + (mapcar #'gnus-group-short-name groups))))) (pathquery (when groups - (concat "(" - (mapconcat (lambda (g) - (format " path:%s" g)) - groups " or") - ")"))) + (concat " (" + (mapconcat (lambda (g) + (format "path:%s" g)) + groups " or") + ")"))) artno dirnam filenam) (when (equal "" qstring) -- 2.19.1 --=-=-=-- From unknown Mon Aug 18 08:27:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 18 Dec 2018 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator