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