[PATCH] emacs: hello: fix accidental modification of widget-keymap
authorMark Walters <markwalters1009@gmail.com>
Thu, 12 Nov 2015 11:02:19 +0000 (11:02 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:03 +0000 (14:50 -0700)
fa/c662f4041547d23ee3965a4f310776e4e2d26a [new file with mode: 0644]

diff --git a/fa/c662f4041547d23ee3965a4f310776e4e2d26a b/fa/c662f4041547d23ee3965a4f310776e4e2d26a
new file mode 100644 (file)
index 0000000..303956f
--- /dev/null
@@ -0,0 +1,109 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id E1C596DE1930\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Nov 2015 03:02:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.175\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.175 tagged_above=-999 required=5 tests=[AWL=0.395,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 0sIjfAI8-flF for <notmuch@notmuchmail.org>;\r
+ Thu, 12 Nov 2015 03:02:27 -0800 (PST)\r
+Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com\r
+ [74.125.82.54]) by arlo.cworth.org (Postfix) with ESMTPS id AB5086DE1583 for\r
+ <notmuch@notmuchmail.org>; Thu, 12 Nov 2015 03:02:26 -0800 (PST)\r
+Received: by wmvv187 with SMTP id v187so26897016wmv.1\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Nov 2015 03:02:24 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id;\r
+ bh=RK2lR7VAgblBNVhf9ZkMp36pT/stVS9lwgiHs8o7MPY=;\r
+ b=bcJwVPE3bCwHdAHWbGeQcqGhi1ZVaN9lYMwJvsHPhxZC+NV0wnJHnewoNdzpw8XRMk\r
+ NqInOfkETzliTlG7NrYa+kcpIVG+LZSMOe+sA/SJfOVZepzhepU3fCw37FmyzrpCCjpw\r
+ L5SRWYhu0YF03KjRwno0UvsLiXZwhZ14EOwrKJ3U1u0QlRtILZzjDs0KzkiVGKN/Q2US\r
+ JkIoXUS6y//yOezfQgcI7H6c20t8Ky1mK01rj35g9ApPL4G0PdiQyABlvTs+Tw1/pqUS\r
+ JMxyfv5fGfs7Ab3Iq+nNyUYIVt5MoFZtL198RCE/HPBWgT6PboOJ5F/pozmTxmc7sC5x\r
+ e0UA==\r
+X-Received: by 10.194.62.73 with SMTP id w9mr14868419wjr.126.1447326144480;\r
+ Thu, 12 Nov 2015 03:02:24 -0800 (PST)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by smtp.gmail.com with ESMTPSA id z13sm8201631wjr.47.2015.11.12.03.02.22\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Thu, 12 Nov 2015 03:02:23 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: hello: fix accidental modification of widget-keymap\r
+Date: Thu, 12 Nov 2015 11:02:19 +0000\r
+Message-Id: <1447326139-13620-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 12 Nov 2015 11:02:31 -0000\r
+\r
+In emacs24 we use make-composed-keymap. It seems that if only a single\r
+map is specified then emacs just resuses it rather than creating a\r
+copy of it. Thus use make-sparse-keymap to force a copy.\r
+---\r
+\r
+pseudomyne and the diredful author thamer found that we modify\r
+widget-keymap in notmuch. We clearly don't want to, and I think we\r
+tried not to, but emacs was being clever and reused the old keymap\r
+rather than creating a new one.\r
+\r
+Anyway the following patch seems to work, and if the user modifies\r
+widget-keymap deliberately then it does get inherited by notmuch-hello\r
+(which was the point of make-composed-keymap rather than just\r
+copy-keymap in the first place).\r
+\r
+The bug only occurs in emacs24. I essentially only use emacs23 so it\r
+has not been tested much.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+ emacs/notmuch-hello.el | 8 ++++++--\r
+ 1 file changed, 6 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 8bde808..b42e0f2 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -652,8 +652,12 @@ with `notmuch-hello-query-counts'."\r
\r
+ (defvar notmuch-hello-mode-map\r
+   (let ((map (if (fboundp 'make-composed-keymap)\r
+-               ;; Inherit both widget-keymap and notmuch-common-keymap\r
+-               (make-composed-keymap widget-keymap)\r
++               ;; Inherit both widget-keymap and\r
++               ;; notmuch-common-keymap. We have to use\r
++               ;; make-sparse-keymap to force this to be a new\r
++               ;; keymap (so that when we modify map it does not\r
++               ;; modify widget-keymap).\r
++               (make-composed-keymap (list (make-sparse-keymap) widget-keymap))\r
+              ;; Before Emacs 24, keymaps didn't support multiple\r
+              ;; inheritance,, so just copy the widget keymap since\r
+              ;; it's unlikely to change.\r
+-- \r
+2.1.4\r
+\r