Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id EDCA04196F0 for ; Mon, 3 May 2010 03:29:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2tv4rR3RvZ4W for ; Mon, 3 May 2010 03:29:37 -0700 (PDT) Received: from homiemail-a15.g.dreamhost.com (caiajhbdccah.dreamhost.com [208.97.132.207]) by olra.theworths.org (Postfix) with ESMTP id D8E5F431FC1 for ; Mon, 3 May 2010 03:29:37 -0700 (PDT) Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPA id E6C9E76C065; Mon, 3 May 2010 03:29:35 -0700 (PDT) From: Sebastian Spaeth To: Notmuch developer list Subject: [PATCHv2 1/2] Make notmuch-hello a mode. Date: Mon, 3 May 2010 12:29:32 +0200 Message-Id: <1272882573-9864-1-git-send-email-Sebastian@SSpaeth.de> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1272879900-8285-1-git-send-email-Sebastian@SSpaeth.de> References: <1272879900-8285-1-git-send-email-Sebastian@SSpaeth.de> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2010 10:29:39 -0000 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 --- 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