Re: [PATCH v3] emacs: show: possible w3m/invisibility workaround
authorAustin Clements <amdragon@MIT.EDU>
Mon, 14 Jan 2013 03:21:10 +0000 (22:21 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:05 +0000 (09:53 -0800)
35/627e40a1f24955c321b285f7a628824f6db02f [new file with mode: 0644]

diff --git a/35/627e40a1f24955c321b285f7a628824f6db02f b/35/627e40a1f24955c321b285f7a628824f6db02f
new file mode 100644 (file)
index 0000000..a80edc5
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <amdragon@mit.edu>\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 8FCCB431FB6\r
+       for <notmuch@notmuchmail.org>; Sun, 13 Jan 2013 20:14:00 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 A8E2V3crkrBb for <notmuch@notmuchmail.org>;\r
+       Sun, 13 Jan 2013 20:13:59 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 991B8431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 13 Jan 2013 20:13:59 -0800 (PST)\r
+X-AuditID: 12074424-b7f4e6d0000004ca-e3-50f386068a34\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 3F.85.01226.60683F05; Sun, 13 Jan 2013 23:13:58 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r0E4Dvek022954; \r
+       Sun, 13 Jan 2013 23:13:58 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r0E4DteM006509\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Sun, 13 Jan 2013 23:13:56 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Tuabm-00023Y-IN; Sun, 13 Jan 2013 22:21:10 -0500\r
+Date: Sun, 13 Jan 2013 22:21:10 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v3] emacs: show: possible w3m/invisibility workaround\r
+Message-ID: <20130114032047.GW17581@mit.edu>\r
+References: <1357862220-1219-1-git-send-email-markwalters1009@gmail.com>\r
+       <1358081032-3066-1-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1358081032-3066-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IRYrdT0WVr+xxgcLFJwGL1XB6L6zdnMjsw\r
+       eeycdZfd49mqW8wBTFFcNimpOZllqUX6dglcGZvf72IqeCBdcWtJO1MD4yqxLkZODgkBE4m/\r
+       k36yQNhiEhfurWcDsYUE9jFKfFwq2cXIBWRvYJQ43viBDcK5yCTxa+khVghnCaPEupe9YC0s\r
+       AqoSp7Y0gNlsAhoS2/YvZwSxRQR0JG4fWsAOYjMLSEt8+93MBGILC3hKHFl6FyzOC1Rz9sgC\r
+       Zoih7YwSv67uZ4ZICEqcnPmEBaJZS+LGv5dAzRxgg5b/4wAJcwLN+XythRXEFhVQkZhychvb\r
+       BEahWUi6ZyHpnoXQvYCReRWjbEpulW5uYmZOcWqybnFyYl5eapGuuV5uZoleakrpJkZwWLuo\r
+       7GBsPqR0iFGAg1GJh3dDyecAIdbEsuLK3EOMkhxMSqK8Vo1AIb6k/JTKjMTijPii0pzU4kOM\r
+       EhzMSiK8oXVAOd6UxMqq1KJ8mJQ0B4uSOO/1lJv+QgLpiSWp2ampBalFMFkZDg4lCV6GVqBG\r
+       waLU9NSKtMycEoQ0EwcnyHAeoOHrWkCGFxck5hZnpkPkTzHqcux/0v6cUYglLz8vVUqc9zxI\r
+       kQBIUUZpHtwcWDp6xSgO9JYw72aQKh5gKoOb9ApoCRPQkrMX3oMsKUlESEk1MLq/EeystC7u\r
+       EjtmmRay+oL4qaypW2dvaZZeNmPdiruqfb+bcyreSX3gr68yLUjKSv3aXhaUWPI14v7aIh+d\r
+       dUvknRlTmk2SKqX6DkyYFpN8ZpqDfN3DctUtxo6no235rkZmhHAJ6//8Y/2zOsFmlvUNH5e7\r
+       Aveavs458uHw+snh1hpvk5iuK7EUZyQaajEXFScCAHvnrfUiAwAA\r
+Cc: notmuch@notmuchmail.org\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: Mon, 14 Jan 2013 04:14:00 -0000\r
+\r
+LGTM.  It's too bad the w3m-link-map logic in\r
+mm-inline-text-html-render-with-w3m doesn't appear to work; it looks\r
+like that would make links follow-able without completely taking over.\r
+\r
+Quoth Mark Walters on Jan 13 at 12:43 pm:\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
+> 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 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
+Could we make it simply render parts on demand when/if they become\r
+visible?  There would be no loss of functionality and things would be\r
+faster overall.\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