aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-05-18 08:53:25 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-05-18 08:53:25 +0200
commit58cc6d6c9b0ecf19096b2ce1185f434d9f68d4d1 (patch)
treef09fc21c2ec9ecc49f22061a3d9d1e1e6c3fe082 /lisp
parentbd7b7f143c006f698e6e3d1901d1948eb78eddf6 (diff)
magit-section-hidden: New function
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit-section.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 9410d86..ea98d61 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1053,7 +1053,14 @@ global map, this involves advising `tab-bar--define-keys'."
(t
(mapc #'magit-section-hide children)))))
+(defun magit-section-hidden (section)
+ "Return t if SECTION and/or an ancestor is hidden."
+ (or (oref section hidden)
+ (and-let* ((parent (oref section parent)))
+ (magit-section-hidden parent))))
+
(defun magit-section-hidden-body (section &optional pred)
+ "Return t if the content of SECTION or of any children is hidden."
(if-let ((children (oref section children)))
(funcall (or pred #'seq-some) #'magit-section-hidden-body children)
(and (oref section content)