From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: hello: fix accidental modification of widget-keymap
Date: Thu, 12 Nov 2015 11:02:19 +0000 [thread overview]
Message-ID: <1447326139-13620-1-git-send-email-markwalters1009@gmail.com> (raw)
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
next reply other threads:[~2015-11-12 11:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 11:02 Mark Walters [this message]
2015-11-21 11:50 ` [PATCH] emacs: hello: fix accidental modification of widget-keymap David Bremner
2015-11-23 12:46 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447326139-13620-1-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).