+ (browse-url notmuch-hello-url))
+ :help-echo "Visit the notmuch website."
+ "notmuch")
+ (widget-insert ". ")
+ (widget-insert "You have ")
+ (widget-create 'link
+ :notify (lambda (&rest ignore)
+ (notmuch-hello-update))
+ :help-echo "Refresh"
+ (notmuch-hello-nice-number
+ (string-to-number (car (process-lines notmuch-command "count")))))
+ (widget-insert " messages.\n"))
+
+ (let ((found-target-pos nil)
+ (final-target-pos nil))
+ (let* ((saved-alist
+ ;; Filter out empty saved searches if required.
+ (if notmuch-show-empty-saved-searches
+ notmuch-saved-searches
+ (loop for elem in notmuch-saved-searches
+ if (> (string-to-number (notmuch-saved-search-count (cdr elem))) 0)
+ collect elem)))
+ (saved-widest (notmuch-hello-longest-label saved-alist))
+ (alltags-alist (if notmuch-show-all-tags-list (notmuch-hello-generate-tag-alist)))
+ (alltags-widest (notmuch-hello-longest-label alltags-alist))
+ (widest (max saved-widest alltags-widest)))
+
+ (when saved-alist
+ ;; Sort saved searches if required.
+ (when notmuch-saved-search-sort-function
+ (setq saved-alist
+ (funcall notmuch-saved-search-sort-function saved-alist)))
+ (widget-insert "\nSaved searches: ")
+ (widget-create 'push-button
+ :notify (lambda (&rest ignore)
+ (customize-variable 'notmuch-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 found-target-pos
+ (setq final-target-pos found-target-pos))
+ (indent-rigidly start (point) notmuch-hello-indent)))
+
+ (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.
+ :size (max 8 (- (window-width) notmuch-hello-indent
+ (length "Search: ")))
+ :action (lambda (widget &rest ignore)
+ (notmuch-hello-search (widget-value widget))))
+ ;; Add an invisible dot to make `widget-end-of-line' ignore
+ ;; trailing spaces in the search widget field. A dot is used
+ ;; instead of a space to make `show-trailing-whitespace'
+ ;; happy, i.e. avoid it marking the whole line as trailing
+ ;; spaces.
+ (widget-insert ".")
+ (put-text-property (1- (point)) (point) 'invisible t)
+ (widget-insert "\n")
+
+ (when notmuch-hello-recent-searches
+ (widget-insert "\nRecent searches: ")
+ (widget-create 'push-button
+ :notify (lambda (&rest ignore)
+ (setq notmuch-hello-recent-searches nil)
+ (notmuch-hello-update))
+ "clear")
+ (widget-insert "\n\n")
+ (let ((start (point))
+ (nth 0))
+ (mapc (lambda (search)
+ (let ((widget-symbol (intern (format "notmuch-hello-search-%d" nth))))
+ (set widget-symbol
+ (widget-create 'editable-field
+ ;; Don't let the search boxes be
+ ;; less than 8 characters wide.
+ :size (max 8
+ (- (window-width)
+ ;; Leave some space
+ ;; at the start and
+ ;; end of the
+ ;; boxes.
+ (* 2 notmuch-hello-indent)
+ ;; 1 for the space
+ ;; before the
+ ;; `[save]' button. 6
+ ;; for the `[save]'
+ ;; button.
+ 1 6))
+ :action (lambda (widget &rest ignore)
+ (notmuch-hello-search (widget-value widget)))
+ search))
+ (widget-insert " ")
+ (widget-create 'push-button
+ :notify (lambda (widget &rest ignore)
+ (notmuch-hello-add-saved-search widget))
+ :notmuch-saved-search-widget widget-symbol
+ "save"))
+ (widget-insert "\n")
+ (setq nth (1+ nth)))
+ notmuch-hello-recent-searches)
+ (indent-rigidly start (point) notmuch-hello-indent)))
+
+ (when alltags-alist
+ (widget-insert "\nAll tags: ")
+ (widget-create 'push-button
+ :notify (lambda (widget &rest ignore)
+ (setq notmuch-show-all-tags-list nil)
+ (notmuch-hello-update))
+ "hide")
+ (widget-insert "\n\n")
+ (let ((start (point)))
+ (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
+ (unless final-target-pos
+ (setq final-target-pos found-target-pos))
+ (indent-rigidly start (point) notmuch-hello-indent)))
+
+ (widget-insert "\n")
+
+ (unless notmuch-show-all-tags-list
+ (widget-create 'push-button
+ :notify (lambda (widget &rest ignore)
+ (setq notmuch-show-all-tags-list t)
+ (notmuch-hello-update))
+ "Show all tags")))