unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer
Date: Thu, 19 Jan 2012 00:22:54 +0400	[thread overview]
Message-ID: <1326918176-20352-2-git-send-email-dmitry.kurochkin@gmail.com> (raw)
In-Reply-To: <1326918176-20352-1-git-send-email-dmitry.kurochkin@gmail.com>

Before the change, "s" in notmuch-hello buffer would jump to the
search box.  The patch changes the binding to `notmuch-search' which
is consistent with all other notmuch buffers.
---
 emacs/notmuch-hello.el                             |   19 ++++++-------------
 test/emacs.expected-output/notmuch-hello           |    2 +-
 .../notmuch-hello-no-saved-searches                |    2 +-
 .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 02017ce..08fcd22 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -29,9 +29,6 @@
 (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))
 (declare-function notmuch-poll "notmuch" ())
 
-(defvar notmuch-hello-search-bar-marker nil
-  "The position of the search bar within the notmuch-hello buffer.")
-
 (defcustom notmuch-recent-searches-max 10
   "The number of recent searches to store and display."
   :type 'integer
@@ -321,11 +318,6 @@ should be. Returns a cons cell `(tags-per-line width)'."
 	(widget-insert "\n"))
     found-target-pos))
 
-(defun notmuch-hello-goto-search ()
-  "Put point inside the `search' widget."
-  (interactive)
-  (goto-char notmuch-hello-search-bar-marker))
-
 (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
 
 (defun notmuch-hello-search-continuation()
@@ -355,7 +347,7 @@ should be. Returns a cons cell `(tags-per-line width)'."
     (define-key map "G" 'notmuch-hello-poll-and-update)
     (define-key map (kbd "<C-tab>") 'widget-backward)
     (define-key map "m" 'notmuch-mua-new-mail)
-    (define-key map "s" 'notmuch-hello-goto-search)
+    (define-key map "s" 'notmuch-search)
     map)
   "Keymap for \"notmuch hello\" buffers.")
 (fset 'notmuch-hello-mode-map notmuch-hello-mode-map)
@@ -468,7 +460,8 @@ Complete list of currently available key bindings:
       (widget-insert " messages.\n"))
 
     (let ((found-target-pos nil)
-	  (final-target-pos nil))
+	  (final-target-pos nil)
+	  (search-bar-pos))
       (let* ((saved-alist
 	      ;; Filter out empty saved searches if required.
 	      (if notmuch-show-empty-saved-searches
@@ -500,7 +493,7 @@ Complete list of currently available key bindings:
 	    (indent-rigidly start (point) notmuch-hello-indent)))
 
 	(widget-insert "\nSearch: ")
-	(setq notmuch-hello-search-bar-marker (point-marker))
+	(setq search-bar-pos (point-marker))
 	(widget-create 'editable-field
 		       ;; Leave some space at the start and end of the
 		       ;; search boxes.
@@ -589,7 +582,7 @@ Complete list of currently available key bindings:
 	(when notmuch-saved-searches
 	  (widget-insert "Edit saved searches with the `edit' button.\n"))
 	(widget-insert "Hit RET or click on a saved search or tag name to view matching threads.\n")
-	(widget-insert "`=' refreshes this screen. `s' jumps to the search box. `q' to quit.\n")
+	(widget-insert "`=' refreshes this screen. `s' to search messages. `q' to quit.\n")
 	(let ((fill-column (- (window-width) notmuch-hello-indent)))
 	  (center-region start (point))))
 
@@ -601,7 +594,7 @@ Complete list of currently available key bindings:
 	  (widget-forward 1)))
 
       (unless (widget-at)
-	(notmuch-hello-goto-search))))
+	(goto-char search-bar-pos))))
 
   (run-hooks 'notmuch-hello-refresh-hook))
 
diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
index de57de2..da47a6b 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -11,4 +11,4 @@ Search:
 	 Type a search query and hit RET to view matching threads.
 		Edit saved searches with the `edit' button.
   Hit RET or click on a saved search or tag name to view matching threads.
-    `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+      `=' refreshes this screen. `s' to search messages. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
index f1fc4d6..202d7d2 100644
--- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
+++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
@@ -7,4 +7,4 @@ Search:
 	 Type a search query and hit RET to view matching threads.
 		Edit saved searches with the `edit' button.
   Hit RET or click on a saved search or tag name to view matching threads.
-    `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+      `=' refreshes this screen. `s' to search messages. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
index dd8728b..d810b51 100644
--- a/test/emacs.expected-output/notmuch-hello-with-empty
+++ b/test/emacs.expected-output/notmuch-hello-with-empty
@@ -11,4 +11,4 @@ Search:
 	 Type a search query and hit RET to view matching threads.
 		Edit saved searches with the `edit' button.
   Hit RET or click on a saved search or tag name to view matching threads.
-    `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
+      `=' refreshes this screen. `s' to search messages. `q' to quit.
-- 
1.7.8.3

  reply	other threads:[~2012-01-18 20:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 19:34 [PATCH 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-17 19:34 ` [PATCH 2/3] emacs: use a single history for all searches Dmitry Kurochkin
2012-01-18  8:25   ` David Edmondson
2012-01-18 17:57     ` Dmitry Kurochkin
2012-01-18 18:18       ` David Edmondson
2012-01-17 19:34 ` [PATCH 3/3] emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-18  8:26   ` David Edmondson
2012-01-17 21:22 ` [PATCH 1/3] emacs: bind "s" to `notmuch-search' " Jani Nikula
2012-01-17 21:29   ` Dmitry Kurochkin
2012-01-26 13:48   ` Pieter Praet
2012-01-26 14:13     ` Jani Nikula
2012-01-18  8:20 ` David Edmondson
2012-01-18 20:22 ` [PATCH v2 0/3] emacs: notmuch-hello search cleanup Dmitry Kurochkin
2012-01-18 20:22   ` Dmitry Kurochkin [this message]
2012-01-18 20:22   ` [PATCH v2 2/3] emacs: use a single history for all searches Dmitry Kurochkin
2012-01-18 20:22   ` [PATCH v2 3/3] emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-19  8:12   ` [PATCH v2 0/3] emacs: notmuch-hello search cleanup David Edmondson
2012-01-23 23:48   ` [PATCH v3 " Dmitry Kurochkin
2012-01-23 23:48     ` [PATCH v3 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-23 23:48     ` [PATCH v3 2/3] emacs: use a single history for all searches Dmitry Kurochkin
2012-01-23 23:48     ` [PATCH v3 3/3] emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-24 15:17     ` [PATCH v3 0/3] emacs: notmuch-hello search cleanup David Edmondson
2012-01-24 15:43     ` Austin Clements
2012-01-25  1:10     ` [PATCH v4 " Dmitry Kurochkin
2012-01-25  1:10       ` [PATCH v4 1/3] emacs: bind "s" to `notmuch-search' in notmuch-hello buffer Dmitry Kurochkin
2012-01-25 12:46         ` David Bremner
2012-01-25  1:10       ` [PATCH v4 2/3] emacs: use a single history for all searches Dmitry Kurochkin
2012-01-25  1:10       ` [PATCH v4 3/3] emacs: bind "s" to `notmuch-hello-search' in notmuch-hello buffer Dmitry Kurochkin

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=1326918176-20352-2-git-send-email-dmitry.kurochkin@gmail.com \
    --to=dmitry.kurochkin@gmail.com \
    --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).