X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-hello.el;h=24e3133d8ae79f3099ddddcc4c90ffe8acdad258;hb=3ac2727dae9a703324982cdb2ac243f195c8c958;hp=2849fc6ffdaae40d7c7eb83585a9332a17e27ee7;hpb=b5c71adc8fb1098c4ce2577b21a662fae346570f;p=notmuch diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 2849fc6f..24e3133d 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"))) @@ -270,14 +272,16 @@ diagonal." (customize-variable 'notmuch-hello-saved-searches)) "edit") (widget-insert "\n\n") + (setq final-target-pos (point-marker)) (let ((start (point))) (setq found-target-pos (notmuch-hello-insert-tags saved-alist widest target)) - (if (not final-target-pos) + (if found-target-pos (setq final-target-pos found-target-pos)) (indent-rigidly start (point) notmuch-hello-indent))) (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. @@ -362,11 +366,9 @@ diagonal." (widget-setup) - (if final-target-pos - (goto-char final-target-pos) - (progn - (goto-char (point-min)) - (widget-forward 1))))) + (goto-char final-target-pos) + (if (not (widget-at)) + (widget-forward 1)))) ;;