summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-11-15 23:55:17 +0000
committerjao <jao@gnu.org>2026-11-15 23:55:17 +0000
commitb6b536bb84a12fd46e91f50ab96ef9473e99b588 (patch)
treec676a038eac0b03c51ed812d3224455f348f5207
parentb27733acd4caadb399f889ba9fe5fe22de120f44 (diff)
downloadelibs-b6b536bb84a12fd46e91f50ab96ef9473e99b588.tar.gz
elibs-b6b536bb84a12fd46e91f50ab96ef9473e99b588.tar.bz2
notmuch
-rw-r--r--attic/elisp/misc.el25
-rw-r--r--custom/jao-custom-notmuch.el6
-rw-r--r--lib/net/jao-notmuch.el59
3 files changed, 43 insertions, 47 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 44728bc..1668251 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -1337,3 +1337,28 @@ It should be the title of the web page as returned by `rdrview'"
(if jao-exwm-use-afio
(setq minibuffer-follows-selected-frame nil)
(jao-exwm-no-afio-setup))
+;;; navigating URLs in notmuch rendered by w3m
+
+(require 'ffap)
+
+(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)
+ (or (forward-button 1 nil t t)
+ (ffap-next-guess))))
+
+(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))
+ (or (backward-button 1 nil t t)
+ (ffap-next-guess t))))
+
+(defun jao-notmuch-show-ret ()
+ (interactive)
+ (when-let* ((url (or (get-text-property (point) 'w3m-href-anchor)
+ (thing-at-point-url-at-point))))
+ (browse-url url)))
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 4d47bf6..1c32d1e 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -203,7 +203,8 @@
:bind (:map notmuch-common-keymap
(("E" . jao-notmuch-open-enclosure)
("B" . notmuch-show-resend-message)
- ("b" . jao-notmuch-browse-urls))))
+ ("b" . jao-notmuch-browse-urls)
+ ("v" . jao-notmuch-view-html))))
(use-package jao-notmuch :demand t)
@@ -500,8 +501,7 @@
("R" . notmuch-tree-reply-sender)
("s" . jao-notmuch-tree-toggle-spam)
("u" . jao-notmuch-tree-toggle-flag)
- ("v" . notmuch-tree-scroll-message-window)
- ("V" . notmuch-tree-scroll-message-window-back)
+ ("v" . jao-notmuch-view-html)
("x" . jao-notmuch-arXiv-capture)
("<" . jao-notmuch-tree-beginning-of-buffer)
(">" . jao-notmuch-tree-end-of-buffer)
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index db23bc1..cc8ad64 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -259,33 +259,6 @@
(message "No URLs in this message")))
-;;; navigating URLs
-
-(require 'ffap)
-
-(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)
- (or (forward-button 1 nil t t)
- (ffap-next-guess))))
-
-(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))
- (or (backward-button 1 nil t t)
- (ffap-next-guess t))))
-
-(defun jao-notmuch-show-ret ()
- (interactive)
- (when-let* ((url (or (get-text-property (point) 'w3m-href-anchor)
- (thing-at-point-url-at-point))))
- (browse-url url)))
-
-
;;; toggling mime parts and images
(defun jao-notmuch--toggle-mime ()
@@ -302,18 +275,21 @@
(jao-notmuch--toggle-mime)
(jao-notmuch-goto-tree-buffer t)))
-(defun jao-notmuch--view-html ()
+(defun jao-notmuch-find-message-part (type)
+ (save-excursion
+ (goto-char (point-min))
+ (text-property-search-forward
+ :notmuch-part
+ type
+ (lambda (value notmuch-part)
+ (equal (plist-get notmuch-part :content-type) value)))))
+
+(defun jao-notmuch-view-html ()
"Open the text/html part of current message using `notmuch-show-view-part'."
(interactive)
- (save-excursion
- (goto-char
- (prop-match-beginning
- (text-property-search-forward
- :notmuch-part
- "text/html"
- (lambda (value notmuch-part)
- (equal (plist-get notmuch-part :content-type)
- value)))))
+ (when-let* (((jao-notmuch-goto-message-buffer nil t))
+ (part (jao-notmuch-find-message-part "text/html")))
+ (goto-char (prop-match-beginning part))
(notmuch-show-view-part)))
(defvar-local jao-notmuch--showing-images nil)
@@ -341,13 +317,8 @@
(jao-notmuch--w3m-toggle-images)))
(window-system (jao-notmuch--shr-toggle-images))
(notmuch-tree-message-buffer
- (if nil ;;(fboundp 'jao-open-in-x-frame)
- (let ((w (get-buffer-window notmuch-tree-message-buffer)))
- (jao-open-in-x-frame (window-width w) (window-height w))
- (jao-notmuch--shr-toggle-images)
- (delete-window))
- (with-current-buffer notmuch-tree-message-buffer
- (jao-notmuch--view-html))))))
+ (with-current-buffer notmuch-tree-message-buffer
+ (jao-notmuch-view-html)))))
;;; header and mode lines with thread message counts