[PATCH] emacs: show: possible w3m/invisibility workaround

Mark Walters markwalters1009 at gmail.com
Thu Jan 10 13:10:15 PST 2013


There is a bug in the current notmuch code with w3m and invisible
parts. w3m sets a keymap, and if we have a hiddent [text/html] point
at the start of the following line still gets this w3m keymap which
causes some strange effects. For example, RET gives an error "No URL
at Point" rather than hiding the message, <down> goes to the next link
rather than just down a line.

This is only likely to be a problem for emacs 23 as shr is preferred
as html renderer on emacs 24. I do not know the correct solution but
this might be a safe work around for 0.15.

This bug was reported on irc by awg.  
---
 emacs/notmuch-show.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5751d98..f526fbf 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -818,6 +818,19 @@ message at DEPTH in the current thread."
 (defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)
   (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))
 
+(defun notmuch-show-insert-part-text/html (msg part content-type nth depth declared-type)
+  ;; text/html to work around bugs in renderers and our invisibile
+  ;; parts code. In particular w3m sets up a keymap which "leaks"
+  ;; outside the invisible region and causes strange effects in
+  ;; notmuch. Thus we override w3m and replace it as w3m-standalone.
+  (let ((mm-text-html-renderer
+	 (if (eq mm-text-html-renderer 'w3m)
+	     'w3m-standalone
+	   mm-text-html-renderer)))
+    (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))
+    (notmuch-mm-display-part-inline msg part nth content-type notmuch-show-process-crypto))
+  t)
+
 (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)
   ;; This handler _must_ succeed - it is the handler of last resort.
   (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))
-- 
1.7.9.1



More information about the notmuch mailing list