X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-hello.el;h=d9fe3ff60b3159b5abbf9664e65ef97f903cd68e;hb=f9d2ccf67b0534637c128fd088957604d0435e7c;hp=3de52386e86ba713575b66b7d81fc75dd177e7cc;hpb=ae2888015e41174aa34203f397ffa034b56cfc61;p=notmuch diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 3de52386..d9fe3ff6 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -28,6 +28,8 @@ (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation)) (declare-function notmuch-poll "notmuch" ()) +(declare-function notmuch-tree "notmuch-tree" + (&optional query query-context target buffer-name open-target)) (defun notmuch-saved-search-get (saved-search field) "Get FIELD from SAVED-SEARCH. @@ -85,15 +87,25 @@ searches so they still work in customize." (group :format "%v" :inline t (const :format " Query: " :query) (string :format "%v"))) (checklist :inline t :format "%v" + (group :format "%v" :inline t (const :format "Shortcut key: " :key) (key-sequence :format "%v")) (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")) (group :format "%v" :inline t (const :format "" :sort-order) (choice :tag " Sort Order" (const :tag "Default" nil) (const :tag "Oldest-first" oldest-first) - (const :tag "Newest-first" newest-first)))))) - -(defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox") - (:name "unread" :query "tag:unread")) + (const :tag "Newest-first" newest-first))) + (group :format "%v" :inline t (const :format "" :search-type) + (choice :tag " Search Type" + (const :tag "Search mode" nil) + (const :tag "Tree mode" tree)))))) + +(defcustom notmuch-saved-searches + `((:name "inbox" :query "tag:inbox" :key ,(kbd "i")) + (:name "unread" :query "tag:unread" :key ,(kbd "u")) + (:name "flagged" :query "tag:flagged" :key ,(kbd "f")) + (:name "sent" :query "tag:sent" :key ,(kbd "t")) + (:name "drafts" :query "tag:draft" :key ,(kbd "d")) + (:name "all mail" :query "*" :key ,(kbd "a"))) "A list of saved searches to display. The saved search can be given in 3 forms. The preferred way is as @@ -101,6 +113,7 @@ a plist. Supported properties are :name Name of the search (required). :query Search to run (required). + :key Optional shortcut key for `notmuch-jump-search'. :count-query Optional extra query to generate the count shown. If not present then the :query property is used. @@ -418,10 +431,13 @@ diagonal." append (notmuch-hello-reflect-generate-row ncols nrows row list)))) (defun notmuch-hello-widget-search (widget &rest ignore) - (notmuch-search (widget-get widget - :notmuch-search-terms) - (widget-get widget - :notmuch-search-oldest-first))) + (if (widget-get widget :notmuch-search-type) + (notmuch-tree (widget-get widget + :notmuch-search-terms)) + (notmuch-search (widget-get widget + :notmuch-search-terms) + (widget-get widget + :notmuch-search-oldest-first)))) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -557,6 +573,7 @@ with `notmuch-hello-query-counts'." (newest-first nil) (oldest-first t) (otherwise notmuch-search-oldest-first))) + (search-type (eq (plist-get elem :search-type) 'tree)) (msg-count (plist-get elem :count))) (widget-insert (format "%8s " (notmuch-hello-nice-number msg-count))) @@ -564,6 +581,7 @@ with `notmuch-hello-query-counts'." :notify #'notmuch-hello-widget-search :notmuch-search-terms query :notmuch-search-oldest-first oldest-first + :notmuch-search-type search-type name) (setq column-indent (1+ (max 0 (- column-width (length name))))))) @@ -621,7 +639,7 @@ with `notmuch-hello-query-counts'." (defun notmuch-hello-versions () "Display the notmuch version(s)" (interactive) - (let ((notmuch-cli-version (notmuch-version))) + (let ((notmuch-cli-version (notmuch-cli-version))) (message "notmuch version %s" (if (string= notmuch-emacs-version notmuch-cli-version) notmuch-cli-version