Function: hs-hide-level

hs-hide-level is an interactive and byte-compiled function defined in hideshow.el.gz.

Signature

(hs-hide-level ARG)

Documentation

Hide all blocks ARG levels below this block.

If point is not in a block, hide all the ARG levels blocks in the whole buffer.

The hook hs-hide-hook is run; see run-hooks.

View in manual

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs-hide-level (arg)
  "Hide all blocks ARG levels below this block.
If point is not in a block, hide all the ARG levels blocks in the whole
buffer.

The hook `hs-hide-hook' is run; see `run-hooks'."
  (interactive "p")
  (hs-life-goes-on
   (save-excursion
     (message "Hiding blocks ...")
     (if (hs-get-near-block)
         ;; Hide block if we are looking at one.
         (pcase-let ((`(,beg ,end) (hs-block-positions)))
           (hs-hide-level-recursive arg beg end hs-hide-comments-when-hiding-all))
       ;; Otherwise hide all the blocks in the current buffer
       (hs-hide-level-recursive
        ;; Increment ARG by 1, avoiding it acts like
        ;; `hs-hide-all'
        (1+ arg) (point-min) (point-max)
        hs-hide-comments-when-hiding-all))
     (message "Hiding blocks ... done"))
   (run-hooks 'hs-hide-hook)))