From bbe892c1810cc6f9d66355d5cabf89889c6668b2 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 2 Oct 2021 01:55:51 +0100 Subject: notmuch: my old M-g command --- lib/net/jao-notmuch.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/net') 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 -- cgit v1.2.3