]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-tree.el
emacs: set default in notmuch-read-query
[notmuch] / emacs / notmuch-tree.el
index 8bf2fbc5c78c2cb9f6a61cc4cc68a75229bb53d2..e9249da11c290cbd8625ece623fa29884b36d655 100644 (file)
@@ -701,10 +701,11 @@ unchanged ADDRESS if parsing fails."
 
      ((string-equal field "tags")
       (let ((tags (plist-get msg :tags))
+           (orig-tags (plist-get msg :orig-tags))
            (face (if match
                      'notmuch-tree-match-tag-face
                    'notmuch-tree-no-match-tag-face)))
-       (format format-string (notmuch-tag-format-tags tags tags face)))))))
+       (format format-string (notmuch-tag-format-tags tags orig-tags face)))))))
 
 (defun notmuch-tree-format-field-list (field-list msg)
   "Format fields of MSG according to FIELD-LIST and return string"
@@ -766,8 +767,10 @@ message together with all its descendents."
        (push "├" tree-status)))
 
       (push (concat (if replies "┬" "─") "►") tree-status)
-      (plist-put msg :first (and first (eq 0 depth)))
-      (notmuch-tree-goto-and-insert-msg (plist-put msg :tree-status tree-status))
+      (setq msg (plist-put msg :first (and first (eq 0 depth))))
+      (setq msg (plist-put msg :tree-status tree-status))
+      (setq msg (plist-put msg :orig-tags (plist-get msg :tags)))
+      (notmuch-tree-goto-and-insert-msg msg)
       (pop tree-status)
       (pop tree-status)
 
@@ -894,6 +897,15 @@ the same as for the function notmuch-tree."
       (set-process-filter proc 'notmuch-tree-process-filter)
       (set-process-query-on-exit-flag proc nil))))
 
+(defun notmuch-tree-get-query ()
+  "Return the current query in this tree buffer"
+  (if notmuch-tree-query-context
+      (concat notmuch-tree-basic-query
+             " and ("
+             notmuch-tree-query-context
+             ")")
+    notmuch-tree-basic-query))
+
 (defun notmuch-tree (&optional query query-context target buffer-name open-target)
   "Display threads matching QUERY in Tree View.