From: Sebastian Spaeth <Sebastian@SSpaeth.de>
To: Notmuch developer list <notmuch@notmuchmail.org>
Subject: [PATCH] Make notmuch-hello a mode.
Date: Mon, 3 May 2010 11:45:00 +0200 [thread overview]
Message-ID: <1272879900-8285-1-git-send-email-Sebastian@SSpaeth.de> (raw)
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
next reply other threads:[~2010-05-03 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 9:45 Sebastian Spaeth [this message]
2010-05-03 10:29 ` [PATCHv2 1/2] Make notmuch-hello a mode 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
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=1272879900-8285-1-git-send-email-Sebastian@SSpaeth.de \
--to=sebastian@sspaeth.de \
--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).