diff options
| -rw-r--r-- | doc/misc/gnus.texi | 12 | ||||
| -rw-r--r-- | 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 fb9113f4608..d1c746c2e56 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -21468,6 +21468,18 @@ The prefix to remove from each file name returned by notmuch in order | |||
| 21468 | to get a group name (albeit with @samp{/} instead of @samp{.}). This | 21468 | to get a group name (albeit with @samp{/} instead of @samp{.}). This |
| 21469 | is a regular expression. | 21469 | is a regular expression. |
| 21470 | 21470 | ||
| 21471 | @item nnir-notmuch-filter-group-names-function | ||
| 21472 | A function used to transform the names of groups being searched in, | ||
| 21473 | for use as a ``path:'' search keyword for notmuch. If nil, the | ||
| 21474 | default, ``path:'' keywords are not used. Otherwise, this should be a | ||
| 21475 | callable which accepts a single group name and returns a transformed | ||
| 21476 | name as notmuch expects to see it. In many mail backends, for | ||
| 21477 | instance, dots in group names must be converted to forward slashes: to | ||
| 21478 | achieve this, set this option to | ||
| 21479 | @example | ||
| 21480 | (lambda (g) (replace-regexp-in-string "\\." "/" g)) | ||
| 21481 | @end example | ||
| 21482 | |||
| 21471 | @end table | 21483 | @end table |
| 21472 | 21484 | ||
| 21473 | 21485 | ||
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index ea7257d0c9b..084b154e8a1 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -518,18 +518,16 @@ that it is for notmuch, not Namazu." | |||
| 518 | :type '(regexp) | 518 | :type '(regexp) |
| 519 | :group 'nnir) | 519 | :group 'nnir) |
| 520 | 520 | ||
| 521 | (defcustom nnir-notmuch-filter-group-names-function | 521 | (defcustom nnir-notmuch-filter-group-names-function nil |
| 522 | #'gnus-group-short-name | ||
| 523 | "Whether and how to use Gnus group names as \"path:\" search terms. | 522 | "Whether and how to use Gnus group names as \"path:\" search terms. |
| 524 | When nil, the groups being searched in are not used as notmuch | 523 | When nil, the groups being searched in are not used as notmuch |
| 525 | :path search terms. It's still possible to use \"path:\" terms | 524 | :path search terms. It's still possible to use \"path:\" terms |
| 526 | manually within the search query, however. | 525 | manually within the search query, however. |
| 527 | 526 | ||
| 528 | When a function, map this function over all the group names. By | 527 | When a function, map this function over all the group names. To |
| 529 | default this runs them through `gnus-group-short-name', and it is | 528 | use the group names unchanged, set to (lambda (g) g). Multiple |
| 530 | recommended to use this transform, at least. Further | 529 | transforms (for instance, converting \".\" to \"/\") can be added |
| 531 | transforms (for instance, converting \".\" to \"/\") can be | 530 | like so: |
| 532 | added like so: | ||
| 533 | 531 | ||
| 534 | \(add-function :filter-return | 532 | \(add-function :filter-return |
| 535 | nnir-notmuch-filter-group-names-function | 533 | nnir-notmuch-filter-group-names-function |
| @@ -1541,14 +1539,15 @@ construct path: search terms (see the variable | |||
| 1541 | ":[0-9]+" | 1539 | ":[0-9]+" |
| 1542 | "^[0-9]+$")) | 1540 | "^[0-9]+$")) |
| 1543 | (groups (when nnir-notmuch-filter-group-names-function | 1541 | (groups (when nnir-notmuch-filter-group-names-function |
| 1544 | (mapcar nnir-notmuch-filter-group-names-function | 1542 | (delq nil |
| 1545 | groups))) | 1543 | (mapcar nnir-notmuch-filter-group-names-function |
| 1544 | (mapcar #'gnus-group-short-name groups))))) | ||
| 1546 | (pathquery (when groups | 1545 | (pathquery (when groups |
| 1547 | (concat "(" | 1546 | (concat " (" |
| 1548 | (mapconcat (lambda (g) | 1547 | (mapconcat (lambda (g) |
| 1549 | (format " path:%s" g)) | 1548 | (format "path:%s" g)) |
| 1550 | groups " or") | 1549 | groups " or") |
| 1551 | ")"))) | 1550 | ")"))) |
| 1552 | artno dirnam filenam) | 1551 | artno dirnam filenam) |
| 1553 | 1552 | ||
| 1554 | (when (equal "" qstring) | 1553 | (when (equal "" qstring) |