Function: hs-minor-mode
hs-minor-mode is an autoloaded, interactive and byte-compiled function
defined in hideshow.el.gz.
Signature
(hs-minor-mode &optional ARG)
Documentation
Minor mode to selectively hide/show code and comment blocks.
When hideshow minor mode is on, the menu bar is augmented with hideshow
commands and the hideshow commands are enabled.
The value (hs . t) is added to buffer-invisibility-spec.
Turning hideshow minor mode off reverts the menu bar and the variables to default values and disables the hideshow commands.
Lastly, the normal hook hs-minor-mode-hook is run using run-hooks.
Key bindings:
<left-fringe> <mouse-1> hs-indicator-mouse-toggle-hiding
C-c @ <backtab> hs-toggle-all
C-c @ C-M-h hs-hide-all
C-c @ C-M-s hs-show-all
C-c @ C-a hs-show-all
C-c @ C-c hs-toggle-hiding
C-c @ C-d hs-hide-block
C-c @ C-e hs-toggle-hiding
C-c @ C-h hs-hide-block
C-c @ C-l hs-hide-level
C-c @ C-s hs-show-block
C-c @ C-t hs-hide-all
C-c @ TAB hs-cycle
S-<mouse-2> hs-toggle-hiding
This is a minor mode. If called interactively, toggle the hs minor
mode mode. If the prefix argument is positive, enable the mode, and if
it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate the variable hs-minor-mode(var)/hs-minor-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
;;;###autoload
(define-minor-mode hs-minor-mode
"Minor mode to selectively hide/show code and comment blocks.
When hideshow minor mode is on, the menu bar is augmented with hideshow
commands and the hideshow commands are enabled.
The value (hs . t) is added to `buffer-invisibility-spec'.
Turning hideshow minor mode off reverts the menu bar and the
variables to default values and disables the hideshow commands.
Lastly, the normal hook `hs-minor-mode-hook' is run using `run-hooks'.
Key bindings:
\\{hs-minor-mode-map}"
:group 'hideshow
:lighter " hs"
:keymap hs-minor-mode-map
(setq hs-headline nil)
(if hs-minor-mode
(progn
(unless (and comment-start comment-end)
(setq hs-minor-mode nil)
(user-error "%S doesn't support the Hideshow minor mode"
major-mode))
;; Set the old variables
(hs-grok-mode-type)
;; Turn off this mode if we change major modes.
(add-hook 'change-major-mode-hook
#'turn-off-hideshow nil t)
(setq-local line-move-ignore-invisible t)
(add-to-invisibility-spec '(hs . t))
;; Add block indicators
(when (and hs-show-indicators
(or (and (integerp hs-indicator-maximum-buffer-size)
(< (buffer-size) hs-indicator-maximum-buffer-size))
(not hs-indicator-maximum-buffer-size)))
(when (and (not (display-graphic-p))
(eq hs-indicator-type 'fringe))
(setq-local hs-indicator-type 'margin))
(when (eq hs-indicator-type 'margin)
(setq-local left-margin-width (1+ left-margin-width))
(setq-local fringes-outside-margins t)
;; Force display of margins
(when (eq (current-buffer) (window-buffer))
(set-window-buffer nil (window-buffer))))
(jit-lock-register #'hs--add-indicators)))
(remove-from-invisibility-spec '(hs . t))
(remove-overlays nil nil 'hs-indicator t)
(remove-overlays nil nil 'invisible 'hs)
(when hs-show-indicators
(jit-lock-unregister #'hs--add-indicators)
(when (and (eq hs-indicator-type 'margin)
(< 0 left-margin-width))
(setq-local left-margin-width (1- left-margin-width))
(kill-local-variable 'fringes-outside-margins)
;; Force removal of margins
(when (eq (current-buffer) (window-buffer))
(set-window-buffer nil (window-buffer)))))))