Re: [PATCH v3] emacs: show: possible w3m/invisibility workaround
authorTomi Ollila <tomi.ollila@iki.fi>
Sun, 13 Jan 2013 13:41:25 +0000 (15:41 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:05 +0000 (09:53 -0800)
07/3619383da5afc6912a6ae6d558cf98452af8c8 [new file with mode: 0644]

diff --git a/07/3619383da5afc6912a6ae6d558cf98452af8c8 b/07/3619383da5afc6912a6ae6d558cf98452af8c8
new file mode 100644 (file)
index 0000000..ddf361e
--- /dev/null
@@ -0,0 +1,143 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id BAB72431FB6\r
+       for <notmuch@notmuchmail.org>; Sun, 13 Jan 2013 05:41:37 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id HF9FXAhJtQAY for <notmuch@notmuchmail.org>;\r
+       Sun, 13 Jan 2013 05:41:36 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 61AB3431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 13 Jan 2013 05:41:36 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id BAD81100045;\r
+       Sun, 13 Jan 2013 15:41:25 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3] emacs: show: possible w3m/invisibility workaround\r
+In-Reply-To: <1358081032-3066-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1357862220-1219-1-git-send-email-markwalters1009@gmail.com>\r
+       <1358081032-3066-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.14+259~g287394f (http://notmuchmail.org) Emacs/24.2.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 13 Jan 2013 15:41:25 +0200\r
+Message-ID: <m2zk0db3p6.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 13 Jan 2013 13:41:38 -0000\r
+\r
+On Sun, Jan 13 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+\r
+> There is a bug in the current notmuch code with w3m and invisible\r
+> parts. w3m sets a keymap, and if we have a hidden [text/html] point\r
+> at the start of the following line still gets this w3m keymap which\r
+> causes some strange effects. For example, RET gives an error "No URL\r
+> at Point" rather than hiding the message, <down> goes to the next link\r
+> rather than just down a line.\r
+>\r
+> These keybinding are also inconvenient when the text/html part is\r
+> displayed so we ask w3m not to install a keymap.\r
+>\r
+> This is only likely to be a problem for emacs 23 as shr is preferred\r
+> as html renderer on emacs 24 (although the user can set the renderer\r
+> to w3m even on emacs 24).\r
+>\r
+> This solution was suggested by Tomi Ollila <tomi.ollila@iki.fi>\r
+> ---\r
+\r
+LGTM.\r
+\r
+> On irc Tomi found the correct way of stopping w3m setting a keymap:\r
+> there is a variable mm-inline-text-html-with-w3m-keymap which can be\r
+> set to nil to tell w3m not to set a keymap.\r
+\r
+I was lucky when looking through the list provided by\r
+M-x customize-group mime-display to figure out whether the whole\r
+group could be referenced from notmuch-show customization group\r
+-- and happened to notice the customization variable in question.\r
+\r
+I have previously discussed "against" picking up individiual external \r
+customization variables to notmuch groups (just due that I could not\r
+find it done before). In case of notmuch-send, there is line\r
+  (custom-add-to-group 'notmuch-send 'message 'custom-group)\r
+in notmuch-lib.el -- as message sending uses message mode (and there\r
+are plenty of useful customization there it makes sense to reference\r
+the whole group. In case of mm-display functionality that doesn't\r
+seem to be the case...\r
+\r
+Tomi\r
+\r
+> I think this is the best solution to this bug for 0.15. My view is\r
+> that this is correct anyway: w3m does render quickly and nicely (and\r
+> will probably be my default renderer from now on) and with this patch\r
+> the keybinding problems are the normal notmuch bindings.\r
+>\r
+> Jani pointed out that in the new invisibility setup all text/html\r
+> parts are rendered (invisibly) when notmuch-show runs. We may want to\r
+> allow the user to supress this: in fact they can by setting\r
+> mm-text-html-renderer to nil but we may want to allow the suppression\r
+> without affecting gnus etc, or we may want to link this option into\r
+> the notmuch-show customization, or maybe just mention in NEWS.\r
+>\r
+> Any such fix is a obviously a separate patch.\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>\r
+>  emacs/notmuch-show.el |   10 ++++++++++\r
+>  1 files changed, 10 insertions(+), 0 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 5751d98..1864dd1 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -818,6 +818,16 @@ message at DEPTH in the current thread."\r
+>  (defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type)\r
+>    (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch"))\r
+>  \r
+> +(defun notmuch-show-insert-part-text/html (msg part content-type nth depth declared-type)\r
+> +  ;; text/html handler to work around bugs in renderers and our\r
+> +  ;; invisibile parts code. In particular w3m sets up a keymap which\r
+> +  ;; "leaks" outside the invisible region and causes strange effects\r
+> +  ;; in notmuch. We set mm-inline-text-html-with-w3m-keymap to nil to\r
+> +  ;; tell w3m not to set a keymap (so the normal notmuch-show-mode-map\r
+> +  ;; remains).\r
+> +  (let ((mm-inline-text-html-with-w3m-keymap nil))\r
+> +    (notmuch-show-insert-part-*/* msg part content-type nth depth declared-type)))\r
+> +\r
+>  (defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)\r
+>    ;; This handler _must_ succeed - it is the handler of last resort.\r
+>    (notmuch-show-insert-part-header nth content-type declared-type (plist-get part :filename))\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r