Function: org-fold-show-children

org-fold-show-children is an interactive and byte-compiled function defined in org-fold.el.gz.

Signature

(org-fold-show-children &optional LEVEL)

Documentation

Show all direct subheadings of this heading.

Prefix arg LEVEL is how many levels below the current level should be shown. Default is enough to cause the following heading to appear.

Key Bindings

Aliases

org-show-children (obsolete since 9.6)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold.el.gz
(defun org-fold-show-children (&optional level)
  "Show all direct subheadings of this heading.
Prefix arg LEVEL is how many levels below the current level
should be shown.  Default is enough to cause the following
heading to appear."
  (interactive "p")
  (unless (org-before-first-heading-p)
    (save-excursion
      (org-with-limited-levels (org-back-to-heading t))
      (let* ((current-level (funcall outline-level))
             (max-level (org-get-valid-level
                         current-level
                         (if level (prefix-numeric-value level) 1)))
             (end (save-excursion (org-end-of-subtree t t)))
             (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)")
             (past-first-child nil)
             ;; Make sure to skip inlinetasks.
             (re (format regexp-fmt
                         current-level
                         (cond
                          ((not (featurep 'org-inlinetask)) "")
                          (org-odd-levels-only (- (* 2 org-inlinetask-min-level)
                                                  3))
                          (t (1- org-inlinetask-min-level))))))
        ;; Display parent heading.
        (org-fold-heading nil)
        (forward-line)
        ;; Display children.  First child may be deeper than expected
        ;; MAX-LEVEL.  Since we want to display it anyway, adjust
        ;; MAX-LEVEL accordingly.
        (while (re-search-forward re end t)
          (unless past-first-child
            (setq re (format regexp-fmt
                             current-level
                             (max (funcall outline-level) max-level)))
            (setq past-first-child t))
          (org-fold-heading nil))))))