emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dslide aed4afd84a 063/230: implement hiding children


From: ELPA Syncer
Subject: [nongnu] elpa/dslide aed4afd84a 063/230: implement hiding children
Date: Sun, 7 Jul 2024 19:00:16 -0400 (EDT)

branch: elpa/dslide
commit aed4afd84ae2209c2125e124056b2e5390c07e73
Author: Psionik K <73710933+psionic-k@users.noreply.github.com>
Commit: Psionik K <73710933+psionic-k@users.noreply.github.com>

    implement hiding children
    
    drive-by fixes on proximate docs
    
    Signed-off-by: Psionik K <73710933+psionic-k@users.noreply.github.com>
---
 macro-slides.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/macro-slides.el b/macro-slides.el
index 350330c55c..6c4b2033d2 100644
--- a/macro-slides.el
+++ b/macro-slides.el
@@ -1996,8 +1996,6 @@ Return the heading unless it's filtered."
 ;; `org-cycle-tree' before calling if strange behavior is observed.
 
 ;; TODO keep-lines seems kind of slow
-;; TODO move this up into the action class and pass through to these as private
-;; methods.
 (defun ms-hide-region (beg end &optional keep-lines)
   "Return overlay hiding region between BEG and END.
 Optional KEEP-LINES will replace region with as many newlines as
@@ -2038,7 +2036,7 @@ the region contains, preserving vertical size."
   "Return an overlay that hides the contents of ELEMENT.
 Element is an org element.  You should probably not use this on
 headings because their contents includes the sections and the
-children.
+children.  See `ms-hide-section' and `ms-hide-children'.
 
 Optional KEEP-LINES will replace region with as many newlines as
 the region contains, preserving vertical size."
@@ -2047,10 +2045,8 @@ the region contains, preserving vertical size."
                   keep-lines))
 
 (defun ms-hide-section (heading &optional keep-lines)
-  "Return an overlay that hides the section of ELEMENT.
-Element is an org element.  You should probably not use this on
-headings because their section includes the sections and the
-children.
+  "Return an overlay that hides the section of HEADING.
+HEADING is a headline type org element.
 
 Optional KEEP-LINES will replace region with as many newlines as
 the region contains, preserving vertical size."
@@ -2059,6 +2055,17 @@ the region contains, preserving vertical size."
    (ms--section-end heading)
    keep-lines))
 
+(defun ms-hide-children (heading &optional keep-lines)
+  "Return an overlay that hides the children of HEADING.
+HEADING is a headline type org element.
+
+Optional KEEP-LINES will replace region with as many newlines as
+the region contains, preserving vertical size."
+  (ms-hide-region
+   (ms--section-end heading)
+   (org-element-end heading)
+   keep-lines))
+
 ;; * Element Mapping
 
 ;; Functions of headings are private so that corresponding slide methods can be



reply via email to

[Prev in Thread] Current Thread [Next in Thread]