summaryrefslogtreecommitdiffhomepage
path: root/custom/jao-custom-notmuch.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-08-16 22:45:07 +0100
committerjao <jao@gnu.org>2022-08-16 22:45:07 +0100
commit48318f342bd8a6db7c1561c139982c658428cacd (patch)
tree933d5a3f41592b31a3aa30f5b2994b5de02f32b3 /custom/jao-custom-notmuch.el
parentcadea0a2da15bb51ede10d0317f8c8fc79d098d9 (diff)
downloadelibs-48318f342bd8a6db7c1561c139982c658428cacd.tar.gz
elibs-48318f342bd8a6db7c1561c139982c658428cacd.tar.bz2
a better jao-notmuch-open-file for consult-recoll
Diffstat (limited to 'custom/jao-custom-notmuch.el')
-rw-r--r--custom/jao-custom-notmuch.el16
1 files changed, 7 insertions, 9 deletions
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"