emacs: notmuch-hello: Move to first saved search item.
authorCarl Worth <cworth@cworth.org>
Tue, 27 Apr 2010 01:40:04 +0000 (18:40 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 27 Apr 2010 01:54:08 +0000 (18:54 -0700)
This give us a useful active widget by default, ("inbox"), and
otherwise gives the first saved search in the user's customized
list. Not having point on the search bar means that the various
keybindings are all available.

emacs/notmuch-hello.el

index 61e85bb64d8a522afde035aa1b3dfdb9c6a8c862..24e3133d8ae79f3099ddddcc4c90ffe8acdad258 100644 (file)
@@ -272,9 +272,10 @@ 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)))
 
@@ -365,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))))
 
 ;;