[PATCH] emacs: tree: support fold/unfold thread

Mark Walters markwalters1009 at gmail.com
Sat Mar 23 01:07:25 PDT 2019


Hello

> This patch allow the user to fold/unfold a thread in the current tree
> buffer by pressing "t" key.

This looks like a really nice feature! I will try and review the code
properly soon, but have some preliminary comments.

> By default a string is displayed at the beginning of the overlay to
> indicate that this thread is folded.

I wonder if it would make sense to make the [....] replace the "tree
symbol" (-> etc)? This would mean that it was always on the screen and the
tree symbol looks a little odd with a collapsed thread.

Secondly, I wonder whether making it collapse just the subthread below
the current message (ie a subtree) would be nice? To me that feels more
generic, but might be more effort than it's worth as the code would need
to deal with nested folds. Then C-u t could do exactly the current
folding (ie the whole thread). But this is just a thought.

Finally a comment on the code

> +The overlay found is located between START and END position in BUFFER."
> +  (seq-find (lambda (ov)

> +(defun notmuch-tree-clean-up-overlays ()
> +  "Remove overlays not referenced to any buffer"
> +  (setq notmuch-tree-overlays (seq-filter #'overlay-buffer notmuch-tree-overlays)))

seq-find and seq-filter are emacs 25+ only I think; at least they don't
seem to be in emacs24 which I think we still support. Perhaps some cl
functions can be used (eg remove-if-not) instead?

Best wishes

Mark



More information about the notmuch mailing list