Variable: hs-indentation-mode

hs-indentation-mode is a buffer-local variable defined in hideshow.el.gz.

Documentation

Non-nil if Hs-Indentation mode is enabled.

Use the command hs-indentation-mode(var)/hs-indentation-mode(fun) to change this variable.

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
;;;###autoload
(define-minor-mode hs-indentation-mode
  "Toggle indentation-based hiding/showing."
  :group 'hideshow
  (if hs-indentation-mode
      (progn
        (setq hs-indentation--store-vars
              (buffer-local-set-state
               hs-forward-sexp-function
               (lambda (_)
                 (let ((size (current-indentation)) end)
                   (save-match-data
                     (save-excursion
                       (forward-line 1) ; Start from next line
                       (while (and (not (eobp))
                                   (re-search-forward hs-block-start-regexp nil t)
                                   (> (current-indentation) size))
                         (setq end (point))
                         (forward-line 1))))
                   (when end (goto-char end) (end-of-line))))
               hs-block-start-regexp (rx (0+ blank) (1+ nonl))
               hs-block-end-regexp nil
               hs-adjust-block-end-function
               ;; Adjust line to the "end of the block" (Usually this is
               ;; the next line after the position by
               ;; `hs-forward-sexp-function' with the same indentation
               ;; level as the block start)
               (if hs-indentation-respect-end-block
                   (lambda (beg)
                     (save-excursion
                       (when (and (not (eobp))
                                  (forward-line 1)
                                  (not (looking-at-p (rx (0+ blank) eol)))
                                  (= (current-indentation)
                                     (save-excursion
                                       (goto-char beg)
                                       (current-indentation)))
                                  (progn (back-to-indentation)
                                         (not (hs-hideable-block-p))))
                         (point))))
                 hs-adjust-block-end-function)
               ;; Set the other variables to their default values
               hs-looking-at-block-start-predicate #'hs-looking-at-block-start-p--default
               hs-find-next-block-function #'hs-find-next-block-fn--default
               hs-find-block-beginning-function #'hs-find-block-beg-fn--default
               hs-c-start-regexp (string-trim-right (regexp-quote comment-start))))
        ;; Refresh indicators (if needed)
        (when (and hs-show-indicators hs-minor-mode)
          (hs-minor-mode -1)
          (hs-minor-mode +1)))
    (buffer-local-restore-state hs-indentation--store-vars)
    (when (and hs-show-indicators hs-minor-mode)
      (hs-minor-mode -1)
      (hs-minor-mode +1))))