summaryrefslogtreecommitdiffhomepage
path: root/lib/net
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-08-16 21:04:57 +0100
committerjao <jao@gnu.org>2021-08-16 21:04:57 +0100
commit446a95fb3dcc591412337ff5b15d067e6d3feb59 (patch)
treee07839ea0ec5d6880cf6cb3c16fbe16b0d7bead9 /lib/net
parent4f2062ba2e94035ecaae0356b055ea3db6bc2cbd (diff)
downloadelibs-446a95fb3dcc591412337ff5b15d067e6d3feb59.tar.gz
elibs-446a95fb3dcc591412337ff5b15d067e6d3feb59.tar.bz2
notmuch: outline mode to toggle threads
Diffstat (limited to 'lib/net')
-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)