From 2d3c3feb69994c08cea262ef958b2b63fc418c87 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 29 Apr 2022 02:51:02 +0100 Subject: recoll: display message/rfc822 via notmuch --- completion.org | 13 +++++++++++-- lib/doc/jao-org-links.el | 11 ----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/completion.org b/completion.org index 3572789..9616da6 100644 --- a/completion.org +++ b/completion.org @@ -569,7 +569,7 @@ (defun jao-recoll-format (title url mtype) (let* ((u (replace-regexp-in-string "/home/jao/" "" url)) (u (replace-regexp-in-string - "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\)/" "" u))) + "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\|var/mail\\)/" "" u))) (format "%s (%s, %s)" title (propertize u 'face 'jao-themes-f00) @@ -600,10 +600,19 @@ (interactive) (jao-recoll (format "dir:%s " jao-org-notes-dir))) + (defun jao-recoll-open-with-notmuch (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))))) + (use-package consult-recoll :init (setq consult-recoll-open-fns '(("application/pdf" . jao-open-doc) - ("message/rfc822" . jao-org-links-open-mail) + ("message/rfc822" . jao-recoll-open-with-notmuch) ("text/html" . jao-recoll-open-html)) consult-recoll-search-flags nil consult-recoll-format-candidate #'jao-recoll-format) diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el index 60b0037..4704624 100644 --- a/lib/doc/jao-org-links.el +++ b/lib/doc/jao-org-links.el @@ -4,7 +4,6 @@ (require 'jao-org-notes) (require 'jao-doc-view) -(require 'jao-notmuch-gnus) (declare pdf-info-outline "pdf-info") @@ -55,16 +54,6 @@ f)) f)))) -(defun jao-org-links-open-mail (fname) - (let ((group (jao-notmuch-gnus-file-to-group fname)) - (id (with-temp-buffer - (insert-file fname) - (goto-char (point-min)) - (message-mode) - (not-modified) - (message-fetch-field "Message-ID")))) - (when (and group id) (org-gnus-follow-link group id)))) - ;;;###autoload (defvar jao-org-links-pdf-store-fun nil) -- cgit v1.2.3