summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-08-23 02:51:09 +0100
committerjao <jao@gnu.org>2021-08-23 02:52:40 +0100
commite73981f7292618adb972b1195944e6b2997ce190 (patch)
tree4ae7843492f37d4adbc039a3424357666ee869fa
parent944e7eceb86b916ed24a85ea40dfc51b5d826e1d (diff)
downloadelibs-e73981f7292618adb972b1195944e6b2997ce190.tar.gz
elibs-e73981f7292618adb972b1195944e6b2997ce190.tar.bz2
notmuch: a better way of recovering the w3m keymap
-rw-r--r--lib/net/jao-notmuch.el35
-rw-r--r--notmuch.org11
-rw-r--r--w3m.org15
3 files changed, 21 insertions, 40 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
diff --git a/notmuch.org b/notmuch.org
index cb20bc1..c144c8a 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -286,15 +286,18 @@
:bind
(:map notmuch-show-mode-map
- (("h" . jao-notmuch-goto-tree-buffer)
- ("TAB" . jao-notmuch-show-next-button)
- ("S-TAB" . jao-notmuch-show-previous-button)
- ("RET" . jao-notmuch-show-ret))))
+ (("h" . jao-notmuch-goto-tree-buffer))))
#+end_src
* search
#+begin_src emacs-lisp
(use-package notmuch-search
+ :init (setq notmuch-search-result-format
+ '(("date" . "%12s ")
+ ("count" . "%-7s ")
+ ("authors" . "%-35s")
+ ("subject" . "%-100s")
+ ("tags" . "(%s)")))
:bind (:map notmuch-search-mode-map
(("RET" . notmuch-tree-from-search-thread)
("M-RET" . notmuch-search-show-thread))))
diff --git a/w3m.org b/w3m.org
index b96b370..6a6b57f 100644
--- a/w3m.org
+++ b/w3m.org
@@ -67,21 +67,6 @@
(kill-new (format "[[doc:%s][%s]] ([[%s][original]])"
basename title url))))
#+end_src
-* Email
- #+begin_src emacs-lisp
- (defun jao-w3m-gnus-html-renderer (handle)
- (let ((w3m-message-silent t)
- (mm-w3m-safe-url-regexp nil)
- (shr-use-colors nil)
- (shr-use-fonts nil)
- (fill-column (min (window-width) 110)))
- (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)
- #+end_src
* Narrowing
#+begin_src emacs-lisp
(with-eval-after-load "w3m-util"