From 0fdce9f23b433ce694c1c6a1e3baca80eb4628ed Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 10 Jul 2021 02:23:24 +0100 Subject: notmuch --- lib/net/jao-notmuch.el | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'lib/net/jao-notmuch.el') diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 9aecd7d..1de94dc 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -80,11 +80,11 @@ (defvar-local jao-notmuch--tree-buffer nil) -(defun jao-notmuch-goto-message-buffer (&optional and-click) +(defun jao-notmuch-goto-message-buffer (&optional and-click no-record) (interactive "P") (when (window-live-p notmuch-tree-message-window) (let ((b (current-buffer))) - (select-window notmuch-tree-message-window) + (select-window notmuch-tree-message-window no-record) (setq-local jao-notmuch--tree-buffer b) (or (not and-click) (cond ((eww--url-at-point) (shr-browse-url) 'url) @@ -93,13 +93,13 @@ (defun jao-notmuch-click-message-buffer () (interactive) (let ((b (current-buffer))) - (unless (eq 'url (jao-notmuch-goto-message-buffer t)) + (unless (eq 'url (jao-notmuch-goto-message-buffer t t)) (pop-to-buffer b)))) -(defun jao-notmuch-goto-tree-buffer () +(defun jao-notmuch-goto-tree-buffer (&optional no-record) (interactive) (if (buffer-live-p jao-notmuch--tree-buffer) - (pop-to-buffer jao-notmuch--tree-buffer) + (pop-to-buffer jao-notmuch--tree-buffer nil no-record) (user-error "No tree view for this buffer"))) (defun jao-notmuch-browse-urls () @@ -111,24 +111,28 @@ (defun jao-notmuch--toggle-mime () (save-excursion (goto-char (point-min)) - (when (re-search-forward "\\[ multipart/alternative \\]" nil t) - (while (forward-button 1 nil nil t) - (notmuch-show-toggle-part-invisibility))))) + (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)))))) (defun jao-notmuch-toggle-mime-parts () (interactive) - (when (jao-notmuch-goto-message-buffer) + (when (jao-notmuch-goto-message-buffer nil t) (goto-char (point-min)) (jao-notmuch--toggle-mime) - (jao-notmuch-goto-tree-buffer) + (jao-notmuch-goto-tree-buffer t) (jao-notmuch--tree-update-buffer-name))) (defun jao-notmuch-show-images () (interactive) (save-window-excursion - (jao-notmuch-goto-message-buffer) - (when (derived-mode-p 'notmuch-show-mode) - (when (or mm-w3m-safe-url-regexp notmuch-show-text/html-blocked-images) + (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 -- cgit v1.2.3