summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/net/jao-notmuch.el35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 1de94dc..52e0fe8 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -102,11 +102,44 @@
(pop-to-buffer jao-notmuch--tree-buffer nil no-record)
(user-error "No tree view for this buffer")))
+(defun jao-notmuch-show-next-button ()
+ (interactive)
+ (when (get-text-property (point) 'w3m-href-anchor)
+ (goto-char (next-single-property-change (point) 'w3m-href-anchor)))
+ (if-let (pos (next-single-property-change (point) 'w3m-href-anchor))
+ (goto-char pos)
+ (forward-button 1)))
+
+(defun jao-notmuch-show-previous-button ()
+ (interactive)
+ (if-let (pos (previous-single-property-change (point) 'w3m-href-anchor))
+ (goto-char (previous-single-property-change pos 'w3m-href-anchor))
+ (backward-button 1)))
+
+(defun jao-notmuch-show-ret ()
+ (interactive)
+ (if-let (url (or (get-text-property (point) 'w3m-href-anchor)
+ (thing-at-point-url-at-point)))
+ (browse-url url)
+ (notmuch-show-toggle-message)))
+
+(defun jao-w3m-get-page-urls (res)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((pos (point)))
+ (while (setq pos (next-single-property-change pos 'w3m-href-anchor))
+ (when-let ((url (get-text-property pos 'w3m-href-anchor)))
+ (add-to-list 'res url t)))
+ res)))
+
(defun jao-notmuch-browse-urls ()
(interactive)
(when (or (derived-mode-p 'notmuch-show-mode)
(jao-notmuch-goto-message-buffer))
- (notmuch-show-browse-urls)))
+ (let ((urls (jao-w3m-get-page-urls (notmuch-show--gather-urls))))
+ (if urls
+ (browse-url (completing-read "Browse URL: " urls))
+ (message "No URLs in this message")))))
(defun jao-notmuch--toggle-mime ()
(save-excursion