unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: hello: fix accidental modification of widget-keymap
@ 2015-11-12 11:02 Mark Walters
  2015-11-21 11:50 ` David Bremner
  2015-11-23 12:46 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Walters @ 2015-11-12 11:02 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: hello: fix accidental modification of widget-keymap
  2015-11-12 11:02 [PATCH] emacs: hello: fix accidental modification of widget-keymap Mark Walters
@ 2015-11-21 11:50 ` David Bremner
  2015-11-23 12:46 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-11-21 11:50 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> 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.

I have tested this patch against the latest diredful.el and it seems to
be OK. Barring protests I'll apply it against release, and start to
build 0.21.1 ; not sure if we have any other suitable bug fixes to
include.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: hello: fix accidental modification of widget-keymap
  2015-11-12 11:02 [PATCH] emacs: hello: fix accidental modification of widget-keymap Mark Walters
  2015-11-21 11:50 ` David Bremner
@ 2015-11-23 12:46 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-11-23 12:46 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> 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.

applied to release and master.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-23 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12 11:02 [PATCH] emacs: hello: fix accidental modification of widget-keymap Mark Walters
2015-11-21 11:50 ` David Bremner
2015-11-23 12:46 ` David Bremner

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).