From 5aaeaa406a5d84b9408746988beb6a5d682d797f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 1 Apr 2020 22:28:23 +0100 Subject: feat(tools/emacs): Implement 'notmuch-show-open-or-close-subthread' Does what it says on the tin. --- tools/emacs/config/functions.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/emacs/config/functions.el b/tools/emacs/config/functions.el index 72e29ae1a8..47d25f2ad5 100644 --- a/tools/emacs/config/functions.el +++ b/tools/emacs/config/functions.el @@ -289,4 +289,17 @@ (-map #'car tag-counts) "Tag:" (-map #'cdr tag-counts) "Count:"))) +(defun notmuch-show-open-or-close-subthread () + "Open or close the subthread from (and including) the message + at point. Opens by default, closes if the prefix argument is + set." + (interactive) + (save-excursion + (let ((current-depth (map-elt (notmuch-show-get-message-properties) :depth 0))) + (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) + (not current-prefix-arg)) + until (or (not (notmuch-show-goto-message-next)) + (= (map-elt (notmuch-show-get-message-properties) :depth 0) current-depth))))) + (force-window-update)) + (provide 'functions) -- cgit 1.4.1