summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/net/jao-notmuch.el25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 48ba775..cedd2cf 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -25,6 +25,7 @@
;;; Code:
(require 'eww)
+(require 'outline)
(require 'notmuch)
(require 'notmuch-tree)
@@ -167,6 +168,25 @@
(message "No URLs in this message")))))
+;; Outline mode for tree view
+
+(defun jao-notmuch--setup-outline ()
+ (setq-local outline-regexp ".+ [┬─] ")
+ (outline-minor-mode 1))
+
+(add-hook 'notmuch-tree-mode-hook #'jao-notmuch--setup-outline)
+
+(defun jao-notmuch--tree-toggle (&rest _args)
+ (when outline-minor-mode
+ (outline-toggle-children)))
+
+(advice-add 'notmuch-tree-matching-message :before #'jao-notmuch--tree-toggle)
+(advice-add 'notmuch-tree-matching-message :after #'jao-notmuch--tree-toggle)
+
+(define-key notmuch-tree-mode-map (kbd "T TAB") 'outline-cycle)
+(define-key notmuch-tree-mode-map (kbd "T t") 'outline-cycle)
+
+
;; Toggling mime parts and images
(defun jao-notmuch--toggle-mime ()
@@ -263,7 +283,10 @@
(let ((buffer (process-buffer proc))
(status (process-status proc)))
(when (and (eq status 'exit) (buffer-live-p buffer))
- (with-current-buffer buffer (jao-notmuch--tree-update-buffer-name)))))
+ (with-current-buffer buffer
+ (jao-notmuch--tree-update-buffer-name)
+ (outline-hide-body)
+ (outline-toggle-children)))))
(advice-add 'notmuch-tree-process-sentinel :after #'jao-notmuch--tree-sentinel)