]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-hello.el
notmuch-hello: Add a 'G' keybinding.
[notmuch] / emacs / notmuch-hello.el
index 5d1f1f8522be8090aa2c654fc3995c6303aee4da..97db90e51a24875c17184363f0d2cfc03c2f0c92 100644 (file)
@@ -45,7 +45,7 @@
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")
 
-(defcustom notmuch-saved-searches notmuch-folders
+(defcustom notmuch-saved-searches nil
   "A list of saved searches to display."
   :type '(alist :key-type string :value-type string)
   :group 'notmuch)
@@ -198,9 +198,24 @@ diagonal."
   (interactive)
   (notmuch-hello no-display))
 
+(defun notmuch-hello-poll-and-update ()
+  "Invoke `notmuch-poll' to import mail, then refresh the current view."
+  (interactive)
+  (notmuch-poll)
+  (notmuch-hello-update))
+
 (defun notmuch-hello (&optional no-display)
   (interactive)
 
+  ;; Provide support for the deprecated name of this variable
+  (if (not notmuch-saved-searches)
+      (setq notmuch-saved-searches notmuch-folders))
+
+  ;; And set a default if neither has been set by the user
+  (if (not notmuch-saved-searches)
+      (setq notmuch-saved-searches '(("inbox" . "tag:inbox")
+                                    ("unread" . "tag:unread"))))
+
   (if no-display
       (set-buffer "*notmuch-hello*")
     (switch-to-buffer "*notmuch-hello*"))
@@ -377,6 +392,7 @@ diagonal."
 
       (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)