[PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-14 Thread Sebastian Spaeth
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


[PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-14 Thread Nelson Elhage
On Thu, May 13, 2010 at 07:58:38PM -0700, sebastian at 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 at 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


Re: [PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-14 Thread Sebastian Spaeth
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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-13 Thread Nelson Elhage
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



[PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-13 Thread sebast...@sspaeth.de
> 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 at 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.



[PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-13 Thread Nelson Elhage
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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: notmuch-hello: Use our own keymap.

2010-05-13 Thread Nelson Elhage
On Thu, May 13, 2010 at 07:58:38PM -0700, sebast...@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-sebast...@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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch