unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Make notmuch-hello a mode.
@ 2010-05-03  9:45 Sebastian Spaeth
  2010-05-03 10:29 ` [PATCHv2 1/2] " Sebastian Spaeth
  2010-05-03 10:29 ` [PATCHv2 2/2] add missing docstring for functions Sebastian Spaeth
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Spaeth @ 2010-05-03  9:45 UTC (permalink / raw)
  To: Notmuch developer list

This enables the nifty '?' key binding to work in notmuch-hello
(although for some strange reasons I don't see any descriptions for
specific key bindings yet. Not sure how that is supposed to work
though.
But this starts, runs and behaves identical to the existing code.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
---
I am not sure this is ready to be commited as is. But it enables the 
'?' key binding and behaves as previously. Perhaps there can be made
some further tweaks as to where to set the buffer read-only now and stuff.

Is this something we could build on? I really enjoy my '?' keybinding.

 emacs/notmuch-hello.el |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6a1c56e..5746fd2 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -213,6 +213,31 @@ diagonal."
   (notmuch-poll)
   (notmuch-hello-update))
 
+
+(defvar notmuch-hello-mode-map
+  (let ((map (copy-keymap widget-keymap)))
+    (define-key map "?" 'notmuch-help)
+    (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" 'kill-this-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\" buffers.")
+(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
+
+(defun notmuch-hello-mode ()
+ "Major mode for conventient notmuch navigation"
+ (interactive)
+ (kill-all-local-variables)
+ (use-local-map notmuch-hello-mode-map)
+ (setq major-mode 'notmuch-hello-mode
+       mode-name "notmuch-hello")
+ ;;(setq buffer-read-only t)
+)
+
 (defun notmuch-hello (&optional no-display)
   (interactive)
 
@@ -237,6 +262,9 @@ diagonal."
     (let ((inhibit-read-only t))
       (erase-buffer))
 
+    (unless (eq major-mode 'notmuch-hello-mode)
+      (notmuch-hello-mode))
+
     (let ((all (overlay-lists)))
       ;; Delete all the overlays.
       (mapc 'delete-overlay (car all))
@@ -397,15 +425,6 @@ 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))))
-
       (widget-setup)
 
       (goto-char final-target-pos)
-- 
1.7.0.4

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

* [PATCHv2 1/2] Make notmuch-hello a mode.
  2010-05-03  9:45 [PATCH] Make notmuch-hello a mode Sebastian Spaeth
@ 2010-05-03 10:29 ` Sebastian Spaeth
  2010-05-14 17:15   ` [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap Nelson Elhage
  2010-05-03 10:29 ` [PATCHv2 2/2] add missing docstring for functions Sebastian Spaeth
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Spaeth @ 2010-05-03 10:29 UTC (permalink / raw)
  To: Notmuch developer list

This enables the nifty '?' key binding to work in notmuch-hello
(although for some strange reasons I don't see any descriptions for
specific key bindings yet. Not sure how that is supposed to work
though.
But this starts, runs and behaves identical to the existing code.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
---
v2 actually includes the key bindings descriptions and also works. 
Patch 2/2 adds doc strings for two used functions that did not have 
one previously.
 
 emacs/notmuch-hello.el |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6a1c56e..1042f31 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -213,6 +213,35 @@ diagonal."
   (notmuch-poll)
   (notmuch-hello-update))
 
+
+(defvar notmuch-hello-mode-map
+  (let ((map (copy-keymap widget-keymap)))
+    (define-key map "v" '(lambda () "Display the notmuch version" (interactive)
+                           (message "notmuch version %s" (notmuch-version))))
+    (define-key map "?" 'notmuch-help)
+    (define-key map "q" 'kill-this-buffer)
+    (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 "s" 'notmuch-hello-goto-search)
+    map)
+  "Keymap for \"notmuch hello\" buffers.")
+(fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
+
+(defun notmuch-hello-mode ()
+ "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
+
+Complete list of currently available key bindings:
+
+\\{notmuch-hello-mode-map}"
+ (interactive)
+ (kill-all-local-variables)
+ (use-local-map notmuch-hello-mode-map)
+ (setq major-mode 'notmuch-hello-mode
+       mode-name "notmuch-hello")
+ ;;(setq buffer-read-only t)
+)
+
 (defun notmuch-hello (&optional no-display)
   (interactive)
 
@@ -237,6 +266,9 @@ diagonal."
     (let ((inhibit-read-only t))
       (erase-buffer))
 
+    (unless (eq major-mode 'notmuch-hello-mode)
+      (notmuch-hello-mode))
+
     (let ((all (overlay-lists)))
       ;; Delete all the overlays.
       (mapc 'delete-overlay (car all))
@@ -397,15 +429,6 @@ 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))))
-
       (widget-setup)
 
       (goto-char final-target-pos)
-- 
1.7.0.4

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

* [PATCHv2 2/2] add missing docstring for functions
  2010-05-03  9:45 [PATCH] Make notmuch-hello a mode Sebastian Spaeth
  2010-05-03 10:29 ` [PATCHv2 1/2] " Sebastian Spaeth
@ 2010-05-03 10:29 ` Sebastian Spaeth
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Spaeth @ 2010-05-03 10:29 UTC (permalink / raw)
  To: Notmuch developer list

The '?' key bindings uses them for the help window and these are
currently empty.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
---
 emacs/notmuch-hello.el |    1 +
 emacs/notmuch-mua.el   |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1042f31..b16af07 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -203,6 +203,7 @@ diagonal."
   (notmuch-hello-update t))
 
 (defun notmuch-hello-update (&optional no-display)
+  "Update the current notmuch view."
   ;; Lazy - rebuild everything.
   (interactive)
   (notmuch-hello no-display))
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index bd06e3c..5a1a059 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -124,6 +124,7 @@ list."
 
 (defun notmuch-mua-mail (&optional to subject other-headers continue
 				   switch-function yank-action send-actions)
+  "Invoke the notmuch mail composition window."
   (interactive)
 
   (when notmuch-mua-user-agent-function
-- 
1.7.0.4

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

* [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap
  2010-05-03 10:29 ` [PATCHv2 1/2] " Sebastian Spaeth
@ 2010-05-14 17:15   ` Nelson Elhage
  2010-06-04  0:32     ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Nelson Elhage @ 2010-05-14 17:15 UTC (permalink / raw)
  To: notmuch

This lets us pick up later changes to widget-keymap if the user
customizes it in some way. This is the recommended way to use
`widget-keymap', according to its help.
---

This goes on top of Sebastian's patch. See
id:1273805175-6660-1-git-send-email-nelhage@ksplice.com, where I
submitted a similar, but less thorough, patch as his.

 emacs/notmuch-hello.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1042f31..5ec2aa4 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -215,7 +215,8 @@ diagonal."
 
 
 (defvar notmuch-hello-mode-map
-  (let ((map (copy-keymap widget-keymap)))
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map widget-keymap)
     (define-key map "v" '(lambda () "Display the notmuch version" (interactive)
                            (message "notmuch version %s" (notmuch-version))))
     (define-key map "?" 'notmuch-help)
-- 
1.6.6.30.g1e6fd

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

* Re: [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap
  2010-05-14 17:15   ` [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap Nelson Elhage
@ 2010-06-04  0:32     ` Carl Worth
  2010-06-04  0:36       ` Nelson Elhage
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Worth @ 2010-06-04  0:32 UTC (permalink / raw)
  To: Nelson Elhage, notmuch

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Fri, 14 May 2010 13:15:38 -0400, Nelson Elhage <nelhage@MIT.EDU> wrote:
> This lets us pick up later changes to widget-keymap if the user
> customizes it in some way. This is the recommended way to use
> `widget-keymap', according to its help.
> ---
> 
> This goes on top of Sebastian's patch. See
> id:1273805175-6660-1-git-send-email-nelhage@ksplice.com, where I
> submitted a similar, but less thorough, patch as his.

Thanks. I've now committed both of Sebastian's as well as yours, here.

Presumably this means I can skip the "smaller, but less thorough" patch
I see from you later in my queue?

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap
  2010-06-04  0:32     ` Carl Worth
@ 2010-06-04  0:36       ` Nelson Elhage
  0 siblings, 0 replies; 6+ messages in thread
From: Nelson Elhage @ 2010-06-04  0:36 UTC (permalink / raw)
  To: Carl Worth, notmuch

On Thu, 03 Jun 2010 17:32:35 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Fri, 14 May 2010 13:15:38 -0400, Nelson Elhage <nelhage@MIT.EDU> wrote:
> > This goes on top of Sebastian's patch. See
> > id:1273805175-6660-1-git-send-email-nelhage@ksplice.com, where I
> > submitted a similar, but less thorough, patch as his.
> 
> Thanks. I've now committed both of Sebastian's as well as yours, here.
> 
> Presumably this means I can skip the "smaller, but less thorough" patch
> I see from you later in my queue?

Correct. Thanks!

- Nelson

> 
> -Carl
> 
> -- 
> carl.d.worth@intel.com
Non-text part: application/pgp-signature

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

end of thread, other threads:[~2010-06-04  0:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03  9:45 [PATCH] Make notmuch-hello a mode Sebastian Spaeth
2010-05-03 10:29 ` [PATCHv2 1/2] " Sebastian Spaeth
2010-05-14 17:15   ` [PATCH] emacs: notmuch-hello: Make widget-keymap a parent of notmuch-hello-keymap Nelson Elhage
2010-06-04  0:32     ` Carl Worth
2010-06-04  0:36       ` Nelson Elhage
2010-05-03 10:29 ` [PATCHv2 2/2] add missing docstring for functions 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).