From 48318f342bd8a6db7c1561c139982c658428cacd Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 16 Aug 2022 22:45:07 +0100 Subject: a better jao-notmuch-open-file for consult-recoll --- custom/jao-custom-notmuch.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'custom') diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index de66943..bbabae2 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -644,14 +644,12 @@ (with-eval-after-load "notmuch-hello" (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder)) ;;; recoll -(defun jao-notmuch-open-file (fname) - (let ((id (with-temp-buffer - (insert-file fname) - (goto-char (point-min)) - (when (re-search-forward "[Mm]essage-[Ii][Dd]: <]+\\)>?" - nil t) - (match-string 1))))) - (when id (notmuch-show (concat "id:" id))))) +(defun jao-notmuch-open-file (fname &optional page) + (with-temp-buffer + (insert-file-contents-literally fname) + (goto-char (point-min)) + (and (re-search-forward "^Message-ID: <\\([^>]+\\)>$" nil t) + (notmuch-show (concat "id:" (match-string 1)))))) (when jao-notmuch-enabled (with-eval-after-load "org" @@ -659,7 +657,7 @@ (with-eval-after-load "consult-recoll" (add-to-list 'consult-recoll-open-fns - ("message/rfc822" . jao-notmuch-open-file)))) + '("message/rfc822" . jao-notmuch-open-file)))) ;;; link hint (with-eval-after-load "link-hint" -- cgit v1.2.3