diff options
| author | jao <jao@gnu.org> | 2025-11-01 15:12:39 +0000 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2025-11-01 15:12:39 +0000 |
| commit | cb0df2b7d23a5848a0130a3a0232509015986450 (patch) | |
| tree | ebc7e17d33db4d42433b2dea3f569df64f8926ba | |
| parent | 75bd2bf7d78fe3c7b6bfeebfa760b02f28fde7d5 (diff) | |
| download | elibs-cb0df2b7d23a5848a0130a3a0232509015986450.tar.gz elibs-cb0df2b7d23a5848a0130a3a0232509015986450.tar.bz2 | |
gnus: fixes for notmuch thread search
| -rw-r--r-- | custom/jao-custom-gnus.el | 12 | ||||
| -rw-r--r-- | lib/net/jao-notmuch-gnus.el | 26 |
2 files changed, 33 insertions, 5 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index 7483e39..b3e1cb6 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -32,6 +32,9 @@ (setq gnus-uncacheable-groups "^nnml") +;;; private config +(require 'jao-gnus-private nil t) + ;;; looks ;;;; verbosity (setq gnus-verbose 4) @@ -227,7 +230,7 @@ (add-to-list ;; `(nnml "" ,(jao-recoll-gnus-search-engine (jao-gnus-dir "Mail/"))) 'gnus-secondary-select-methods - `(nnml "" (gnus-search-engine gnus-search-notmuch + `(nnml "" (gnus-search-engine gnus-search-jao-notmuch (remove-prefix ,prefix)))))) (when jao-gnus-use-nnml @@ -302,7 +305,7 @@ gnus-refer-thread-use-search t gnus-summary-make-false-root 'adopt gnus-summary-gather-subject-limit nil ;; 120 - gnus-summary-thread-gathering-function #'gnus-gather-threads-by-subject + gnus-summary-thread-gathering-function #'gnus-gather-threads-by-references gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date gnus-thread-sort-functions '(gnus-thread-sort-by-date)) @@ -310,7 +313,7 @@ (let ((references (mail-header-references header))) (setf (mail-header-references header) (mapconcat #'(lambda (x) - (if (string-match "protonmail.internalid" x) "" x)) + (if (string-match-p "protonmail.internalid" x) "" x)) (gnus-split-references references) " ")) header)) @@ -369,7 +372,8 @@ "ElDiario.es - ElDiario.es: " "The Guardian: " "Aeon | a world of ideas: " - "Planet Debian: ")) + "Planet Debian: " + " via The Rust Programming Language Forum")) "\\|The Conversation – Articles (.+): " "\\|unofficial mirror of [^:]+: " "\\|[gq].+ updates on arXiv.org: ")) diff --git a/lib/net/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el index 3abfaee..aa63d7c 100644 --- a/lib/net/jao-notmuch-gnus.el +++ b/lib/net/jao-notmuch-gnus.el @@ -110,8 +110,32 @@ (add-to-list 'gnus-search-expandable-keys "list") -(cl-defmethod gnus-search-transform-expression ((engine gnus-search-notmuch) +(defclass gnus-search-jao-notmuch (gnus-search-notmuch) ()) + +(cl-defmethod gnus-search-indexed-search-command + ((engine gnus-search-jao-notmuch) (qstring string) query &optional groups) + (let* ((limit (alist-get 'limit query)) + (thread (alist-get 'thread query)) + (qs (cond (thread + (format "thread:\"{%s}\"" + (thread-last (string-replace "\"" "\"\"" qstring) + (string-replace "<" "") + (string-replace ">" "")))) + (groups + (let ((gs (mapconcat 'gnus-group-short-name groups "|"))) + (format "(%s) and folder:/%s/" qstring gs))) + (t qstring)))) + (with-slots (switches config-file) engine + `(,(format "--config=%s" config-file) "search" "--output=files" + ,@(unless thread '("--duplicate=1")) + ,@(when limit (list (format "--limit=%d" limit))) + ,@switches + ,qs)))) + + +(cl-defmethod gnus-search-transform-expression ((engine gnus-search-jao-notmuch) (expr (head list))) + (message "List query: %s" expr) (format "List:%s" (gnus-search-transform-expression engine (cdr expr)))) |
