branch: externals/taxy commit 4686e03bc81c32322ff15edcf32996ecd495c659 Author: Adam Porter <a...@alphapapa.net> Commit: Adam Porter <a...@alphapapa.net>
Add: (taxy-size) --- images/diredy.png | Bin 33772 -> 36255 bytes taxy-magit-section.el | 7 +++++-- taxy.el | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/images/diredy.png b/images/diredy.png index 4e8f3e5..7e84fb4 100644 Binary files a/images/diredy.png and b/images/diredy.png differ diff --git a/taxy-magit-section.el b/taxy-magit-section.el index d14f36b..1760b52 100644 --- a/taxy-magit-section.el +++ b/taxy-magit-section.el @@ -65,8 +65,11 @@ descendant taxys; if `last', insert them after descendants." (magit-insert-heading (make-string (* depth taxy-magit-section-indent) ? ) (propertize (taxy-name taxy) 'face 'magit-section-heading) - (when (taxy-description taxy) - (concat " (" (taxy-description taxy) ")"))) + (format " (%s%s)" + (if (taxy-description taxy) + (concat (taxy-description taxy) " ") + "") + (taxy-size taxy))) (magit-insert-section-body (when (eq 'first objects) (mapc #'insert-object (taxy-objects taxy))) diff --git a/taxy.el b/taxy.el index 6ba04a5..334d1c8 100644 --- a/taxy.el +++ b/taxy.el @@ -175,6 +175,13 @@ by KEY-NAME-FN called with OBJECT." (taxy-take-keyed* (cdr key-fns) object taxy) (push object (taxy-objects taxy)))))) +(defun taxy-size (taxy) + "Return the number of objects TAXY holds. +Includes objects in TAXY's sub-taxys." + (cl-loop for sub-taxy in (taxy-taxys taxy) + sum (taxy-size sub-taxy) into total + finally return (+ total (length (taxy-objects taxy))))) + ;;;; Footer (provide 'taxy)