]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: hello: fix accidental modification of widget-keymap
authorMark Walters <markwalters1009@gmail.com>
Thu, 12 Nov 2015 11:02:19 +0000 (11:02 +0000)
committerDavid Bremner <david@tethera.net>
Mon, 23 Nov 2015 12:36:52 +0000 (08:36 -0400)
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.

emacs/notmuch-hello.el

index 8bde808fae6cc09fffb7631be2bf8f3fb67aec4c..b42e0f24148a01201c12468e584e20d0740649f8 100644 (file)
@@ -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.