From 44d6cb5fb993a5d3948266c9944ede2108291c3f Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 10 Jan 2013 23:56:59 +0000 Subject: [PATCH] [PATCH v2] emacs: show: possible w3m/invisibility workaround --- 92/1ff3d2b085dd2038852eb8c6d2fe74c1aa5761 | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 92/1ff3d2b085dd2038852eb8c6d2fe74c1aa5761 diff --git a/92/1ff3d2b085dd2038852eb8c6d2fe74c1aa5761 b/92/1ff3d2b085dd2038852eb8c6d2fe74c1aa5761 new file mode 100644 index 000000000..aaee61d23 --- /dev/null +++ b/92/1ff3d2b085dd2038852eb8c6d2fe74c1aa5761 @@ -0,0 +1,129 @@ +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 61FE0431FB6 + for ; Thu, 10 Jan 2013 15:57:04 -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 V7y0ULvBHowq for ; + Thu, 10 Jan 2013 15:57:03 -0800 (PST) +Received: from mail-we0-f169.google.com (mail-we0-f169.google.com + [74.125.82.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A9785431FAF + for ; Thu, 10 Jan 2013 15:57:03 -0800 (PST) +Received: by mail-we0-f169.google.com with SMTP id t49so601263wey.28 + for ; Thu, 10 Jan 2013 15:57:02 -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=klXmTIWdskVwXkqrB3Wx7GmP4zyT3HeU7EE09nodJLY=; + b=h0SUJmPE47zax8PoIHwsTSfUhjiqi31P7k02MLHI423iHDlqxHZjctwTGtwxkeQ00z + Vo7OXBDIeCTRnNy043/rGMXot1Xz0Sl4Df3OSNlEYFJUQnImgpSClVofBOwvBGqz1pni + cPi/FS91OBHT1FyCIektgQTyHJibP2BGaozG32CChsC+sOswyLsBUJnDKm70nhGXsJEh + 7q5Rbrn1HXKdr3o+Kz08l7JoqmFLU4GtLCsZyOAzmftbUqhY464AKn9oCAnNx5F7ny6B + gB0XKmeOIlQgSYuob/3bn+EC9IG8XIuw+0EEPm1t2lxSbw1a9w52nLMtrNaHyF4LODVH + ffvQ== +X-Received: by 10.194.78.236 with SMTP id e12mr62040313wjx.32.1357862222542; + Thu, 10 Jan 2013 15:57:02 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id hu8sm10590073wib.6.2013.01.10.15.57.01 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 10 Jan 2013 15:57:01 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2] emacs: show: possible w3m/invisibility workaround +Date: Thu, 10 Jan 2013 23:56:59 +0000 +Message-Id: <1357862220-1219-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1357852215-16788-1-git-send-email-markwalters1009@gmail.com> +References: <1357852215-16788-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: Thu, 10 Jan 2013 23:57:04 -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 replace the w3m keymap by notmuch-show-mode-map. + +This is only likely to be a problem for emacs 23 as shr is preferred +as html renderer on emacs 24. +--- +This is probably better than v1 as this keeps the users chosen +renderer and justs overrides the (in my opinion) inconvenient (for +notmuch-show use) keymap w3m provides. + +There are some questions: + +1) does anyone use w3m with notmuch and really want the keymap not overridden? + +2) is copying notmuch-show-mode-map needed? + +3) notmuch-show-mode-map is not defined at this point in notmuch-show +(but obviously is when the function is called). What is the best way +to avoid a compile warning? + +This seems to me like a plausible basis for a solution for 0.15. This is not a +full fix but does hide the problem. Moreover even with a genuine fix +for the invisibility corner cases I think this might be desirable for +the case when the text/html part is displayed. + +Best wishes + +Mark + + + 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..8443c54 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. The w3m keymap is rather odd for notmuch use: several ++ ;; keys conflict with notmuch-show-mode-map so just override by ++ ;; notmuch-show-mode-map. ++ (let ((w3m-minor-mode-map (when (eq mm-text-html-renderer 'w3m) ++ (copy-keymap notmuch-show-mode-map)))) ++ (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 + -- 2.26.2