Function: hs-hide-all
hs-hide-all is an interactive and byte-compiled function defined in
hideshow.el.gz.
Signature
(hs-hide-all)
Documentation
Hide all top level blocks, displaying only first and last lines.
Move point to the beginning of the line, and run the normal hook
hs-hide-hook. See documentation for run-hooks.
If hs-hide-comments-when-hiding-all is non-nil, also hide the comments.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
;;---------------------------------------------------------------------------
;; commands
(defun hs-hide-all ()
"Hide all top level blocks, displaying only first and last lines.
Move point to the beginning of the line, and run the normal hook
`hs-hide-hook'. See documentation for `run-hooks'.
If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments."
(interactive)
(hs-life-goes-on
(save-excursion
(unless hs-allow-nesting
(hs-discard-overlays (point-min) (point-max)))
(goto-char (point-min))
(syntax-propertize (point-max))
(let ((spew (make-progress-reporter "Hiding all blocks..."
(point-min) (point-max)))
(re (concat "\\("
hs-block-start-regexp
"\\)"
(if hs-hide-comments-when-hiding-all
(concat "\\|\\("
hs-c-start-regexp
"\\)")
""))))
(while (progn
(unless hs-hide-comments-when-hiding-all
(forward-comment (point-max)))
(re-search-forward re (point-max) t))
(if (match-beginning 1)
;; We have found a block beginning.
(progn
(goto-char (match-beginning 1))
(unless (if hs-hide-all-non-comment-function
(funcall hs-hide-all-non-comment-function)
(hs-hide-block-at-point t))
;; Go to end of matched data to prevent from getting stuck
;; with an endless loop.
(when (looking-at hs-block-start-regexp)
(goto-char (match-end 0)))))
;; found a comment, probably
(let ((c-reg (hs-inside-comment-p)))
(when (and c-reg (car c-reg))
(if (> (count-lines (car c-reg) (nth 1 c-reg)) 1)
(hs-hide-block-at-point t c-reg)
(goto-char (nth 1 c-reg))))))
(progress-reporter-update spew (point)))
(progress-reporter-done spew)))
(beginning-of-line)
(run-hooks 'hs-hide-hook)))