diff options
-rw-r--r-- | lib/net/jao-notmuch.el | 17 | ||||
-rw-r--r-- | notmuch.org | 12 |
2 files changed, 20 insertions, 9 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index d5e239e..d93ebdb 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -108,15 +108,18 @@ (when (stringp url) (cl-pushnew url res :test #'string=)))) (seq-uniq res #'string=)))) +(defun jao-notmuch-message-urls () + (save-window-excursion + (when (or (derived-mode-p 'notmuch-show-mode) + (jao-notmuch-goto-message-buffer)) + (jao-notmuch--page-urls (notmuch-show--gather-urls))))) + (defun jao-notmuch-browse-urls (&optional external) (interactive "P") - (when (or (derived-mode-p 'notmuch-show-mode) - (jao-notmuch-goto-message-buffer)) - (let ((urls (jao-notmuch--page-urls (notmuch-show--gather-urls))) - (fn (if external browse-url-secondary-browser-function #'browse-url))) - (if urls - (funcall fn (completing-read "Browse URL: " urls)) - (message "No URLs in this message"))))) + (if-let ((urls (jao-notmuch-message-urls))) + (funcall (if external browse-url-secondary-browser-function #'browse-url) + (completing-read "Browse URL: " urls)) + (message "No URLs in this message"))) ;;;; Navigating URLs diff --git a/notmuch.org b/notmuch.org index a07443a..5e838e4 100644 --- a/notmuch.org +++ b/notmuch.org @@ -72,10 +72,11 @@ ,(jao-notmuch--qn "emacs" "diffs" "ec" '("tag:emacs-diffs")) ,(jao-notmuch--qn "feeds" "lobsters" "fl" '("tag:lobsters")) ,(jao-notmuch--qn "feeds" "notmuch" "fn" '("tag:notmuch")) + ,(jao-notmuch--qn "feeds" "haskell" "fh" '("tag:haskell")) ,(jao-notmuch--qn "feeds" "xmobar" "fx" '("tag:xmobar")) ,(jao-notmuch--qn "feeds" "prog" "fp" '("tag:prog" - "not tag:\"/(lobsters|xmobar|notmuch)/\"")) + "not tag:\"/(lobsters|xmobar|notmuch|haskell)/\"")) ,@(jao-notmuch--mboxes-search "feeds" "emacs" "prog") ,(jao-notmuch--q "bml" "today" "tb" '("tag:bigml" "date:24h..") t) ,(jao-notmuch--q "jao" "today" "tj" @@ -344,6 +345,12 @@ (interactive) (jao-notmuch-tree--forward t)) + (defun jao-notmuch-browse-url (ext) + (interactive "P") + (when-let (url (car (last (jao-notmuch-message-urls)))) + (funcall (if ext browse-url-secondary-browser-function #'browse-url) + url))) + :bind (:map notmuch-tree-mode-map (("b" . jao-notmuch-browse-urls) ("C" . jao-notmuch-echo-count) @@ -372,7 +379,8 @@ ("." . jao-notmuch-toggle-mime-parts) ("=" . jao-notmuch-tree-toggle-message) ("RET" . jao-notmuch-tree-show-or-scroll) - ("SPC" . jao-notmuch-tree-scroll-or-next)))) + ("SPC" . jao-notmuch-tree-scroll-or-next) + ("M-g" . jao-notmuch-browse-url)))) #+end_src * consult #+begin_src emacs-lisp |