[PATCH] emacs: notmuch-tree: customizable strings for drawing trees

2021-08-20 Thread jao
New customizable variable, notmuch-tree-tread-symbols, that allows
tweaking how trees in a forest are represented.  For instance, one can
now choose to use an hyphen rather than a white space as a prefix, or
remove pointy arrows.
---
 emacs/notmuch-tree.el | 35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 01a77b71..27e5ac3a 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -74,6 +74,21 @@
   notmuch-unthreaded-show-out
 notmuch-tree-show-out))
 
+(defcustom notmuch-tree-thread-symbols '(" " "─" "┬" "│" "├" "╰" "►")
+  "List of strings used to draw trees.
+The first element is used at the top of the tree, followed by the
+second if it has no direct children or the third if it does.  The
+fourth is a bar connecting with a response down the list skipping
+the current one, while the fifth does not skip.  The sixth and
+the bottom of the thread.  Finally, the last one is a pointer to
+every messages.
+
+Common customizations include setting the first element of the
+list to \"-\", to see equal-length prefixes, or the last and
+empty string or a different kind of arrow point."
+  :type '(list string)
+  :group 'notmuch-tree)
+
 (defcustom notmuch-tree-result-format
   `(("date" . "%12s  ")
 ("authors" . "%-20s")
@@ -968,20 +983,20 @@ message together with all its descendents."
(replies (cadr tree)))
 (cond
  ((and (< 0 depth) (not last))
-  (push "├" tree-status))
+  (push (elt notmuch-tree-thread-symbols 4) tree-status))
  ((and (< 0 depth) last)
-  (push "╰" tree-status))
+  (push (elt notmuch-tree-thread-symbols 5) tree-status))
  ((and (eq 0 depth) first last)
-  ;; Choice between these two variants is a matter of taste.
-  ;; (push "─" tree-status))
-  (push " " tree-status))
+  (push (elt notmuch-tree-thread-symbols 0) tree-status))
  ((and (eq 0 depth) first (not last))
-  (push "┬" tree-status))
+  (push (elt notmuch-tree-thread-symbols 2) tree-status))
  ((and (eq 0 depth) (not first) last)
-  (push "╰" tree-status))
+  (push (elt notmuch-tree-thread-symbols 5) tree-status))
  ((and (eq 0 depth) (not first) (not last))
-  (push "├" tree-status)))
-(push (concat (if replies "┬" "─") "►") tree-status)
+  (push (elt notmuch-tree-thread-symbols 4) tree-status)))
+(push (concat (elt notmuch-tree-thread-symbols (if replies 2 1))
+ (elt notmuch-tree-thread-symbols 6))
+ 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)))
@@ -990,7 +1005,7 @@ message together with all its descendents."
 (pop tree-status)
 (if last
(push " " tree-status)
-  (push "│" tree-status))
+  (push (elt notmuch-tree-thread-symbols 3) tree-status))
 (notmuch-tree-insert-thread replies (1+ depth) tree-status)))
 
 (defun notmuch-tree-insert-thread (thread depth tree-status)
-- 
2.33.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-08-20 Thread David Bremner
Alan Schmitt  writes:

> On 2021-08-01 23:11, David Bremner  writes:
>
>> With commit 37f84d6d2 (only in master currently), much larger threads
>> should be displayable in unthreaded view, e.g using M-x
>> notmuch-unthreaded
>
> I just updated to 0.32.3, and I confirm a message is displayed quite
> fast (if I set notmuch-show-only-matching-messages to t). However, if I
> choose a message too deep in the thread, I get an error 
>
> show-insert-thread: Lisp nesting exceeds ‘max-lisp-eval-depth’
>
> and the message is not displayed.

The commit I mentioned is not in 0.32.3.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [EMACS] feature proposal (with code): notmuch-rainbow-tags.el

2021-08-20 Thread Tom Hirschowitz

Well, here's one: I tried it with my usual theme, which is rather dark,
and it looked bad. Tried to fiddle with it a bit, but not long enough to
succeed, whence gave up.

> Dan Čermák  writes:
>
>> Hi Alexander,
>>
>> Alexander Adolf  writes:
>>
>>>
>>> That was the other option. I thought I'd post it here first, to see
>>> whether there would be any momentum for including it in notmuch
>>> itself?
>>
>> That actually sounds like a good idea. Maybe just send it as a patch to
>> the mailinglist? Not sure if there is really a different process for
>> getting something included in notmuch.
>
> You're certainly welcome to send it as a patch (not to be confused with
> "patches welcome!" ;)), but it might also make sense to get more
> feedback.  My only concern would be dependencies, which seems fine
> (there are none?). On the other hand, I tend to be not the most expert
> or most opinionated about emacs UI fine points, so it would be good to
> hear a bit broader feedback.
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: performance in emacs displaying a huge thread

2021-08-20 Thread Alan Schmitt
Hello,

On 2021-08-01 23:11, David Bremner  writes:

> With commit 37f84d6d2 (only in master currently), much larger threads
> should be displayable in unthreaded view, e.g using M-x
> notmuch-unthreaded

I just updated to 0.32.3, and I confirm a message is displayed quite
fast (if I set notmuch-show-only-matching-messages to t). However, if I
choose a message too deep in the thread, I get an error 

show-insert-thread: Lisp nesting exceeds ‘max-lisp-eval-depth’

and the message is not displayed.

After experimenting a bit, it seems this is happening when the messages
in the thread are encrypted. I don’t seem to be able to reproduce this
error with messages that are not encrypted.

Could something special be happening with long threads of encrypted
messages?

Thanks,

Alan


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org