summaryrefslogtreecommitdiffhomepage
path: root/lib/net
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/jao-notmuch.el49
1 files changed, 24 insertions, 25 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 52e0fe8..c470682 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -116,13 +116,6 @@
(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))
@@ -132,24 +125,25 @@
(add-to-list 'res url t)))
res)))
-(defun jao-notmuch-browse-urls ()
- (interactive)
+(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-w3m-get-page-urls (notmuch-show--gather-urls))))
+ (let ((urls (jao-w3m-get-page-urls (notmuch-show--gather-urls)))
+ (fn (if external browse-url-secondary-browser-function #'browse-url)))
(if urls
- (browse-url (completing-read "Browse URL: " urls))
+ (funcall fn (completing-read "Browse URL: " urls))
(message "No URLs in this message")))))
+
+;; Toggling mime parts and images
+
(defun jao-notmuch--toggle-mime ()
(save-excursion
(goto-char (point-min))
- (when (forward-button 1 nil nil t)
- (when (looking-at-p "\\[ multipart/alternative")
- (when (looking-at-p "\\[ multipart/alternative (hidden)")
- (push-button))
- (while (forward-button 1 nil nil t)
- (notmuch-show-toggle-part-invisibility))))))
+ (while (and (re-search-forward "^\\[ text/\\(html\\|plain\\) " nil t)
+ (button-at (point)))
+ (notmuch-show-toggle-part-invisibility))))
(defun jao-notmuch-toggle-mime-parts ()
(interactive)
@@ -164,14 +158,19 @@
(save-window-excursion
(when (and (jao-notmuch-goto-message-buffer nil t)
(derived-mode-p 'notmuch-show-mode))
- (when (or mm-w3m-safe-url-regexp
- notmuch-show-text/html-blocked-images)
- (setq-local mm-w3m-safe-url-regexp nil
- notmuch-show-text/html-blocked-images nil
- shr-inhibit-images nil
- shr-blocked-images nil)
- (notmuch-refresh-this-buffer))
- (jao-notmuch--toggle-mime))))
+ (goto-char (point-min))
+ (when (re-search-forward "^\\[ text/html " nil t)
+ (when (looking-at-p "(hidden)")
+ (notmuch-show-toggle-part-invisibility))
+ (forward-line 1)
+ (w3m-toggle-inline-images)))))
+
+(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)))
;; Keeping track of unread messages in current tree view