(defface notmuch-tree-match-tree-face
nil
- "Face used in tree mode for the thread tree block graphics in messages matching the query."
+ "Face used in tree mode for the thread tree block graphics in
+messages matching the query."
:group 'notmuch-tree
:group 'notmuch-faces)
(defface notmuch-tree-no-match-tree-face
nil
- "Face used in tree mode for the thread tree block graphics in messages matching the query."
+ "Face used in tree mode for the thread tree block graphics in
+messages matching the query."
:group 'notmuch-tree
:group 'notmuch-faces)
(define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search)
(define-key map "o" 'notmuch-tree-toggle-order)
+ (define-key map "i" 'notmuch-tree-toggle-hide-excluded)
(define-key map "S" 'notmuch-search-from-tree-current-query)
(define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
(define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
"Call notmuch search with the current query."
(interactive)
(notmuch-tree-close-message-window)
- (notmuch-search (notmuch-tree-get-query)))
+ (notmuch-search (notmuch-tree-get-query)
+ notmuch-search-oldest-first
+ notmuch-search-hide-excluded))
(defun notmuch-tree-message-window-kill-hook ()
"Close the message pane when exiting the show buffer."
target
nil
unthreaded
- notmuch-search-oldest-first)))
+ notmuch-search-oldest-first
+ notmuch-search-hide-excluded)))
(defun notmuch-tree-thread-top ()
(when (notmuch-tree-get-message-properties)
'face face)))
((string-equal field "subject")
- (let ((bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
+ (let ((bare-subject
+ (notmuch-sanitize
+ (notmuch-show-strip-re (plist-get headers :Subject))))
(previous-subject notmuch-tree-previous-subject)
(face (if match
'notmuch-tree-match-subject-face
(notmuch-tree-insert-thread replies (1+ depth) tree-status)))
(defun notmuch-tree-insert-thread (thread depth tree-status)
- "Insert the collection of sibling sub-threads THREAD at depth DEPTH in the current forest."
+ "Insert the collection of sibling sub-threads THREAD at depth
+DEPTH in the current forest."
(let ((n (length thread)))
(cl-loop for tree in thread
for count from 1 to n
results-buf)))))
(defun notmuch-tree-worker (basic-query &optional query-context target
- open-target unthreaded oldest-first)
+ open-target unthreaded oldest-first
+ exclude)
"Insert the tree view of the search in the current buffer.
This is is a helper function for notmuch-tree. The arguments are
(notmuch-tree-mode)
(add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
(setq notmuch-search-oldest-first oldest-first)
+ (setq notmuch-search-hide-excluded exclude)
(setq notmuch-tree-unthreaded unthreaded)
(setq notmuch-tree-basic-query basic-query)
(setq notmuch-tree-query-context (if (or (string= query-context "")
(and query-context
(concat " and (" query-context ")"))))
(sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
- (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+ (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+ (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
(when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
(setq search-args basic-query))
(notmuch-tag-clear-cache)
(let ((proc (notmuch-start-notmuch
"notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
"show" "--body=false" "--format=sexp" "--format-version=5"
- sort-arg message-arg search-args))
+ sort-arg message-arg exclude-arg search-args))
;; Use a scratch buffer to accumulate partial output.
;; This buffer will be killed by the sentinel, which
;; should be called no matter how the process dies.
(setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
(notmuch-tree-refresh-view))
+(defun notmuch-tree-toggle-hide-excluded ()
+ "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
+ (interactive)
+ (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
+ (notmuch-tree-refresh-view))
+
+;;;###autoload
(defun notmuch-tree (&optional query query-context target buffer-name
- open-target unthreaded parent-buffer oldest-first)
+ open-target unthreaded parent-buffer
+ oldest-first hide-excluded)
"Display threads matching QUERY in tree view.
The arguments are:
it is nil \"*notmuch-tree\" followed by QUERY is used.
OPEN-TARGET: If TRUE open the target message in the message pane.
UNTHREADED: If TRUE only show matching messages in an unthreaded view."
- (interactive)
+ (interactive
+ (list
+ ;; Prompt for a query
+ nil
+ ;; Fill other args with nil.
+ nil nil nil nil nil nil
+ ;; Populate these from the default value of these options.
+ (default-value 'notmuch-search-oldest-first)
+ (default-value 'notmuch-search-hide-excluded)))
(unless query
(setq query (notmuch-read-query (concat "Notmuch "
(if unthreaded "unthreaded " "tree ")
(pop-to-buffer-same-window buffer))
;; Don't track undo information for this buffer
(setq buffer-undo-list t)
- (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+ (notmuch-tree-worker query query-context target open-target
+ unthreaded oldest-first hide-excluded)
(setq notmuch-tree-parent-buffer parent-buffer)
(setq truncate-lines t))
(defun notmuch-unthreaded (&optional query query-context target buffer-name
- open-target)
+ open-target oldest-first hide-excluded)
"Display threads matching QUERY in unthreaded view.
See function NOTMUCH-TREE for documentation of the arguments"
- (interactive)
- (notmuch-tree query query-context target buffer-name open-target t))
+ (interactive
+ (list
+ ;; Prompt for a query
+ nil
+ ;; Fill other args with nil.
+ nil nil nil nil
+ ;; Populate these from the default value of these options.
+ (default-value 'notmuch-search-oldest-first)
+ (default-value 'notmuch-search-hide-excluded)))
+ (notmuch-tree query query-context target buffer-name open-target
+ t nil oldest-first hide-excluded))
(defun notmuch-tree-filter (query)
"Filter or LIMIT the current search results based on an additional query string.
nil
notmuch-tree-unthreaded
nil
- notmuch-search-oldest-first)))
+ notmuch-search-oldest-first
+ notmuch-search-hide-excluded)))
(defun notmuch-tree-edit-search (query)
"Edit the current search"