From 9823e901c3d903e8ffe0a24ce692ad6192186643 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 28 Jun 2022 03:18:58 +0100 Subject: notmuch:// for browse-url (useful, e.g., for markdown-mode) --- custom/jao-custom-notmuch.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'custom') diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index d65958f..5673242 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -541,6 +541,16 @@ ("M-g" . jao-notmuch-browse-url) ("M-u" . jao-notmuch-tree-reset-tags)))) +;;; browse-url +(defvar jao-notmuch-url-rx "^notmuch:\\(/+\\|id:\\)\\(.+\\)") + +(defun jao-notmuch-open-url (url &rest _) + (and (string-match jao-notmuch-url-rx url) + (notmuch-show (concat "id:" (match-string 2 url))))) + +(add-to-list 'browse-url-handlers + (cons jao-notmuch-url-rx 'jao-notmuch-open-url)) + ;;; org mode (defvar jao-org-notmuch-last-subject nil) (defun jao-org-notmuch-last-subject () jao-org-notmuch-last-subject) -- cgit v1.2.3