diff options
author | jao <jao@gnu.org> | 2021-08-23 02:51:09 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-08-23 02:52:40 +0100 |
commit | e73981f7292618adb972b1195944e6b2997ce190 (patch) | |
tree | 4ae7843492f37d4adbc039a3424357666ee869fa /lib | |
parent | 944e7eceb86b916ed24a85ea40dfc51b5d826e1d (diff) | |
download | elibs-e73981f7292618adb972b1195944e6b2997ce190.tar.gz elibs-e73981f7292618adb972b1195944e6b2997ce190.tar.bz2 |
notmuch: a better way of recovering the w3m keymap
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/jao-notmuch.el | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index d3c7841..316ece4 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -25,6 +25,8 @@ ;;; Code: (require 'outline) +(require 'mm-decode) +(require 'mm-view) (require 'notmuch) (require 'notmuch-tree) @@ -89,27 +91,13 @@ jao-notmuch-tree-beginning-of-buffer beginning-of-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--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))) - (cl-pushnew url res))) + (when (stringp url) (cl-pushnew url res :test #'string=)))) res))) (defun jao-notmuch-browse-urls (&optional external) @@ -173,12 +161,17 @@ (add-hook 'notmuch-show-mode-hook #'jao-notmuch--setup-w3m-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))) +;; fix w3m renderer keymap +(defun jao-w3m-gnus-html-renderer (handle) + (let ((w3m-message-silent t) + (mm-inline-text-html-with-w3m-keymap t) + (mm-w3m-safe-url-regexp nil)) + (condition-case nil + (mm-inline-text-html-render-with-w3m handle) + (error (delete-region (point) (point-max)) + (mm-shr handle))))) + +(setq mm-text-html-renderer #'jao-w3m-gnus-html-renderer) ;; Keeping track of unread messages in current tree view |