From 9af5239971df315d1403733eb1e38039375ffdc9 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 30 Jun 2022 15:30:17 +0100 Subject: notmuch nits --- attic/net/jao-notmuch-gnus.el | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'attic/net') diff --git a/attic/net/jao-notmuch-gnus.el b/attic/net/jao-notmuch-gnus.el index e18c5a1..1576964 100644 --- a/attic/net/jao-notmuch-gnus.el +++ b/attic/net/jao-notmuch-gnus.el @@ -28,7 +28,6 @@ (require 'ol-gnus) (require 'notmuch-show) - ;;; Tagging in notmuch from Gnus buffers (defun jao-notmuch-gnus--notmuch-id (id) @@ -100,8 +99,16 @@ (add-hook 'gnus-summary-article-move-hook #'jao-notmuch-gnus-tag-on-move) (add-hook 'gnus-summary-article-expire-hook #'jao-notmuch-gnus-tag-on-move)) - -;;;; Displaying search results in Gnus +;;; Gnus search using notmuch + +(add-to-list 'gnus-search-expandable-keys "list") + +(cl-defmethod gnus-search-transform-expression ((engine gnus-search-notmuch) + (expr (head list))) + (format "List:%s" (gnus-search-transform-expression engine (cdr expr)))) + + +;;; Displaying search results in Gnus (defvar jao-notmuch-gnus-server "nnml" "Name of the target Gnus server, e.g. nnml+mail.") @@ -164,8 +171,14 @@ Example: (org-gnus-follow-link group msg-id) (message "Couldn't get relevant infos for switching to Gnus.")))) - -;;;; Org links +(defun jao-notmuch-gnus-engine (prefix config) + (let ((prefix (file-name-as-directory (expand-file-name prefix "~"))) + (config (expand-file-name config gnus-home-directory))) + `(gnus-search-engine gnus-search-notmuch + (remove-prefix ,prefix) + (config-file ,config)))) + +;;; Org links (defun jao-notmuch-gnus--fname (id) (let ((cmd (format "notmuch search --output=files id:%s" id))) (car (split-string (shell-command-to-string cmd))))) @@ -193,8 +206,7 @@ Example: (org-link-set-parameters "gnus" :store #'ignore) (org-link-set-parameters "notmuch" :store #'ignore) - -;;;; consult-notmuch +;;; consult-notmuch (with-eval-after-load "consult-notmuch" (defun jao-notmuch-gnus--open-candidate (candidate) @@ -209,5 +221,6 @@ Example: (consult-customize jao-gnus-consult-notmuch :preview-key 'any)) +;;; . (provide 'jao-notmuch-gnus) ;;; jao-notmuch-gnus.el ends here -- cgit v1.2.3