diff options
author | Carl Worth <cworth@cworth.org> | 2010-04-26 18:52:49 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-04-26 18:54:08 -0700 |
commit | f2f6da9af09541d5e15d39d165d5185dcdb47d5b (patch) | |
tree | 4e55e790230d3a5a9215df22f975291c0caac244 | |
parent | b5c71adc8fb1098c4ce2577b21a662fae346570f (diff) |
emacs: Fix 's' keybinding to go to search bar in notmuch-hello.
This command was previously written under the fragile assumption that
the search bar was always the third widget. That's no longer true with
the saved searches now appearing before the search bar, so we save the
position of the search bar and go directly to it now.
-rw-r--r-- | emacs/notmuch-hello.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 2849fc6f..61e85bb6 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -29,6 +29,9 @@ (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation)) (declare-function notmuch-folder-count "notmuch" (search)) +(defvar notmuch-hello-search-bar-marker nil + "The position of the search bar within the notmuch-hello buffer.") + (defcustom notmuch-hello-recent-searches-max 10 "The number of recent searches to store and display." :type 'integer @@ -179,10 +182,9 @@ diagonal." found-target-pos)) (defun notmuch-hello-goto-search () - "Put point inside the `search' widget, which we know is first." + "Put point inside the `search' widget." (interactive) - (goto-char (point-min)) - (widget-forward 3)) + (goto-char notmuch-hello-search-bar-marker)) (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png"))) @@ -278,6 +280,7 @@ diagonal." (let ((start (point))) (widget-insert "\nSearch: ") + (setq notmuch-hello-search-bar-marker (point-marker)) (widget-create 'editable-field ;; Leave some space at the start and end of the ;; search boxes. |