* [PATCH] emacs: notmuch-hello: Use our own keymap.
@ 2010-05-14 2:46 Nelson Elhage
2010-05-14 2:58 ` sebastian
0 siblings, 1 reply; 4+ messages in thread
From: Nelson Elhage @ 2010-05-14 2:46 UTC (permalink / raw)
To: notmuch
Previously, we were adding our bindings directly to `widget-keymap',
resulting in them being shared by anything else that used that keymap.
---
emacs/notmuch-hello.el | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6a1c56e..56906c8 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -70,6 +70,19 @@
(defvar notmuch-hello-recent-searches nil)
+(defvar notmuch-hello-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map widget-keymap)
+ (define-key map "=" 'notmuch-hello-update)
+ (define-key map "G" 'notmuch-hello-poll-and-update)
+ (define-key map "m" 'notmuch-mua-mail)
+ (define-key map "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
+ (define-key map "s" 'notmuch-hello-goto-search)
+ (define-key map "v" '(lambda () (interactive)
+ (message "notmuch version %s" (notmuch-version))))
+ map)
+ "Keymap for notmuch-hello buffer")
+
(defun notmuch-hello-remember-search (search)
(if (not (member search notmuch-hello-recent-searches))
(push search notmuch-hello-recent-searches))
@@ -397,14 +410,7 @@ diagonal."
(let ((fill-column (- (window-width) notmuch-hello-indent)))
(center-region start (point))))
- (use-local-map widget-keymap)
- (local-set-key "=" 'notmuch-hello-update)
- (local-set-key "G" 'notmuch-hello-poll-and-update)
- (local-set-key "m" 'notmuch-mua-mail)
- (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
- (local-set-key "s" 'notmuch-hello-goto-search)
- (local-set-key "v" '(lambda () (interactive)
- (message "notmuch version %s" (notmuch-version))))
+ (use-local-map notmuch-hello-mode-map)
(widget-setup)
--
1.6.6.30.g1e6fd
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: notmuch-hello: Use our own keymap.
2010-05-14 2:46 [PATCH] emacs: notmuch-hello: Use our own keymap Nelson Elhage
@ 2010-05-14 2:58 ` sebastian
2010-05-14 3:34 ` Nelson Elhage
0 siblings, 1 reply; 4+ messages in thread
From: sebastian @ 2010-05-14 2:58 UTC (permalink / raw)
To: Nelson Elhage; +Cc: notmuch
> Previously, we were adding our bindings directly to `widget-keymap',
> resulting in them being shared by anything else that used that keymap.
Is this patch preferable over the one I sent some time ago in
id:1272882573-9864-1-git-send-email-Sebastian@SSpaeth.de ?
My patch makes notmuch-hello a major mode and also creates the proper
keymap. THe major mode allows the '?' keybinding to also work.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: notmuch-hello: Use our own keymap.
2010-05-14 2:58 ` sebastian
@ 2010-05-14 3:34 ` Nelson Elhage
2010-05-14 16:53 ` Sebastian Spaeth
0 siblings, 1 reply; 4+ messages in thread
From: Nelson Elhage @ 2010-05-14 3:34 UTC (permalink / raw)
To: sebastian; +Cc: notmuch
On Thu, May 13, 2010 at 07:58:38PM -0700, sebastian@sspaeth.de wrote:
> > Previously, we were adding our bindings directly to `widget-keymap',
> > resulting in them being shared by anything else that used that keymap.
>
> Is this patch preferable over the one I sent some time ago in
> id:1272882573-9864-1-git-send-email-Sebastian@SSpaeth.de ?
>
> My patch makes notmuch-hello a major mode and also creates the proper
> keymap. THe major mode allows the '?' keybinding to also work.
>
Ah, I failed to properly search the mail archives before sending
this. Your patch looks preferable with one exception: I think that
making widget-keymap a parent of notmuch-hello-mode-map is probably
better than just copying widget-keymap -- if someone defines
additional bindings in widget-keymap, we should inherit them whether
they are defined before or after notmuch-hello is loaded. (This is
also recommended by the documentation for `widget-keymap').
- Nelson
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: notmuch-hello: Use our own keymap.
2010-05-14 3:34 ` Nelson Elhage
@ 2010-05-14 16:53 ` Sebastian Spaeth
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Spaeth @ 2010-05-14 16:53 UTC (permalink / raw)
To: Nelson Elhage; +Cc: notmuch
On 2010-05-14, Nelson Elhage wrote:
> Ah, I failed to properly search the mail archives before sending
> this.
No problem, I admit that my subject title does not obviously point out
that it creates a proper keymap ;-).
> Your patch looks preferable with one exception: I think that
> making widget-keymap a parent of notmuch-hello-mode-map is probably
> better than just copying widget-keymap.
That sounds good to me. I am generally an elisp newbie and was just
using the first approach that worked for me. Do you want to update the
patch?
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-14 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14 2:46 [PATCH] emacs: notmuch-hello: Use our own keymap Nelson Elhage
2010-05-14 2:58 ` sebastian
2010-05-14 3:34 ` Nelson Elhage
2010-05-14 16:53 ` Sebastian Spaeth
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).