Function: hs-hide-level-recursive

hs-hide-level-recursive is a byte-compiled function defined in hideshow.el.gz.

Signature

(hs-hide-level-recursive ARG BEG END &optional INCLUDE-COMMENTS FUNC PROGRESS)

Documentation

Recursively hide blocks between BEG and END that are ARG levels below point.

If INCLUDE-COMMENTS is non-nil, also hide recursive comment blocks. If FUNC is non-nil, call this function to hide the block instead. If PROGRESS is non-nil, also update a progress object, intended for commands.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-hide-level-recursive (arg beg end &optional include-comments func progress)
  "Recursively hide blocks between BEG and END that are ARG levels below point.
If INCLUDE-COMMENTS is non-nil, also hide recursive comment blocks.  If
FUNC is non-nil, call this function to hide the block instead.  If
PROGRESS is non-nil, also update a progress object, intended for
commands."
  ;; Show all blocks in that region
  (unless hs-allow-nesting (hs-discard-overlays beg end))
  (goto-char beg)
  (while (not (>= (point) end))
    (when-let* ((_ (not (invisible-p (point)))) ; Skip invisible lines
                (b-start (hs-get-first-block-on-line include-comments)))
      (goto-char b-start)
      (let ((comment (and include-comments (funcall hs-inside-comment-predicate)))
            (code (hs-block-positions)))
        ;; Find a block recursively according to ARG.
        (if (> arg 1)
            ;; Nested comment blocks in a comment block are impossible,
            ;; so skip them.
            (if comment
                (goto-char (cadr comment))
              (pcase-let ((`(,beg ,end) code))
                (hs-hide-level-recursive (1- arg) beg end include-comments)))
          ;; Now hide the block we found.
          (if func (funcall func) (hs-hide-block-at-point comment))
          (when progress (progress-reporter-update progress (point))))))
    (forward-line 1))
  (goto-char end))