summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-06-28 03:18:58 +0100
committerjao <jao@gnu.org>2022-06-28 03:18:58 +0100
commit9823e901c3d903e8ffe0a24ce692ad6192186643 (patch)
treec5d8a096015ec93d019fe2b267ae4fcbb8aa9ce5
parent537949a150129f0854b046b7ebd6faab69db5e8e (diff)
downloadelibs-9823e901c3d903e8ffe0a24ce692ad6192186643.tar.gz
elibs-9823e901c3d903e8ffe0a24ce692ad6192186643.tar.bz2
notmuch:// for browse-url (useful, e.g., for markdown-mode)
-rw-r--r--custom/jao-custom-notmuch.el10
1 files changed, 10 insertions, 0 deletions
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)