From 491b6f246f5afea828c2b0e4add0f8ffa0107ecf Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 13 Jan 2013 12:43:52 +0000 Subject: [PATCH] [PATCH v3] emacs: show: possible w3m/invisibility workaround --- c4/d84c6d5accf834c2d6fb3e53f8711f97ab8231 | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 c4/d84c6d5accf834c2d6fb3e53f8711f97ab8231 diff --git a/c4/d84c6d5accf834c2d6fb3e53f8711f97ab8231 b/c4/d84c6d5accf834c2d6fb3e53f8711f97ab8231 new file mode 100644 index 000000000..cb9243900 --- /dev/null +++ b/c4/d84c6d5accf834c2d6fb3e53f8711f97ab8231 @@ -0,0 +1,130 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5937D431FB6 + for ; Sun, 13 Jan 2013 04:43:58 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id fCG8sEgZ1CPe for ; + Sun, 13 Jan 2013 04:43:57 -0800 (PST) +Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com + [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 589E6431FAF + for ; Sun, 13 Jan 2013 04:43:57 -0800 (PST) +Received: by mail-wi0-f172.google.com with SMTP id o1so715762wic.11 + for ; Sun, 13 Jan 2013 04:43:56 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to + :references; bh=HizGeywuovt5Qcriu6NojLy475rIONGfGO1YbzD8gtE=; + b=EtALzM9x4y2oPdm3zOkoCfqFJTrx3wxXAlnQvGOn8QpcIy+qxY4/DBBRa8AxfePRX7 + rpQvSopaETZPZ3ROuCwK14EKe2IQOZiQSr78dq9n+VaJF+F8e1lxARNiWV9QMmVPBsWh + o9AXxEIPebThMdIYK1WiKCTDDaK0IntyZI3Hf14DdjB6O94496DVgLHHEdFckHRPBArb + wfJ49yHzAQI9xtngz3mxj3npMe4CgHbwKmJvl0vtH1d0U4lzHIbdyt4+kf45NwluMfCA + f44XbJX807tvI1OJJ49b2e5UAcSB2k/iQuujjLqefyqTruHBWMsZe8RFrhkJVvyFyR+b + dlxw== +X-Received: by 10.180.95.135 with SMTP id dk7mr7464929wib.29.1358081034918; + Sun, 13 Jan 2013 04:43:54 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id g2sm8753025wiy.0.2013.01.13.04.43.53 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 13 Jan 2013 04:43:54 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v3] emacs: show: possible w3m/invisibility workaround +Date: Sun, 13 Jan 2013 12:43:52 +0000 +Message-Id: <1358081032-3066-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1357862220-1219-1-git-send-email-markwalters1009@gmail.com> +References: <1357862220-1219-1-git-send-email-markwalters1009@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 13 Jan 2013 12:43:58 -0000 + +There is a bug in the current notmuch code with w3m and invisible +parts. w3m sets a keymap, and if we have a hidden [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, goes to the next link +rather than just down a line. + +These keybinding are also inconvenient when the text/html part is +displayed so we ask w3m not to install a keymap. + +This is only likely to be a problem for emacs 23 as shr is preferred +as html renderer on emacs 24 (although the user can set the renderer +to w3m even on emacs 24). + +This solution was suggested by Tomi Ollila +--- + +On irc Tomi found the correct way of stopping w3m setting a keymap: +there is a variable mm-inline-text-html-with-w3m-keymap which can be +set to nil to tell w3m not to set a keymap. + +I think this is the best solution to this bug for 0.15. My view is +that this is correct anyway: w3m does render quickly and nicely (and +will probably be my default renderer from now on) and with this patch +the keybinding problems are the normal notmuch bindings. + +Jani pointed out that in the new invisibility setup all text/html +parts are rendered (invisibly) when notmuch-show runs. We may want to +allow the user to supress this: in fact they can by setting +mm-text-html-renderer to nil but we may want to allow the suppression +without affecting gnus etc, or we may want to link this option into +the notmuch-show customization, or maybe just mention in NEWS. + +Any such fix is a obviously a separate patch. + +Best wishes + +Mark + + + + emacs/notmuch-show.el | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 5751d98..1864dd1 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -818,6 +818,16 @@ 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 handler 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. We set mm-inline-text-html-with-w3m-keymap to nil to ++ ;; tell w3m not to set a keymap (so the normal notmuch-show-mode-map ++ ;; remains). ++ (let ((mm-inline-text-html-with-w3m-keymap nil)) ++ (notmuch-show-insert-part-*/* msg part content-type nth depth declared-type))) ++ + (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 + -- 2.26.2