Function: indent-bars--guess-spacing

indent-bars--guess-spacing is a natively compiled function defined in indent-bars.el.

Signature

(indent-bars--guess-spacing)

Documentation

Get indentation spacing of current buffer.

Adapted from highlight-indentation-mode.

Source Code

;; Defined in /nix/store/zkcdcnmcj3605fj09x584bf58d85brax-emacs-packages-deps/share/emacs/site-lisp/elpa/indent-bars-1.0.1/indent-bars.el
;;;; Setup and mode
(defun indent-bars--guess-spacing ()
  "Get indentation spacing of current buffer.
Adapted from `highlight-indentation-mode'."
  (cond
   (indent-bars-spacing-override)
   ((and (derived-mode-p 'ada-mode) (boundp 'ada-indent))
    ada-indent)
   ((and (derived-mode-p 'ada-ts-mode) (boundp 'ada-ts-mode-indent-offset))
    ada-ts-mode-indent-offset)
   ((and (derived-mode-p 'gpr-mode) (boundp 'gpr-indent))
    gpr-indent)
   ((and (derived-mode-p 'gpr-ts-mode) (boundp 'gpr-ts-mode-indent-offset))
    gpr-ts-mode-indent-offset)
   ((and (derived-mode-p 'python-mode) (boundp 'py-indent-offset))
    py-indent-offset)
   ((and (derived-mode-p 'python-mode 'python-base-mode)
	 (boundp 'python-indent-offset))
    python-indent-offset)
   ((and (derived-mode-p 'ruby-mode) (boundp 'ruby-indent-level))
    ruby-indent-level)
   ((and (derived-mode-p 'scala-mode) (boundp 'scala-indent:step))
    scala-indent:step)
   ((and (derived-mode-p 'scala-mode) (boundp 'scala-mode-indent:step))
    scala-mode-indent:step)
   ((and (derived-mode-p 'scala-ts-mode) (boundp 'scala-ts-indent-offset))
    scala-ts-indent-offset)
   ((and (derived-mode-p 'rust-ts-mode) (boundp 'rust-ts-mode-indent-offset))
    rust-ts-mode-indent-offset)
   ((and (or (derived-mode-p 'scss-mode) (derived-mode-p 'css-mode))
	 (boundp 'css-indent-offset))
    css-indent-offset)
   ((and (derived-mode-p 'nxml-mode) (boundp 'nxml-child-indent))
    nxml-child-indent)
   ((and (derived-mode-p 'coffee-mode) (boundp 'coffee-tab-width))
    coffee-tab-width)
   ((and (derived-mode-p 'js-mode) (boundp 'js-indent-level))
    js-indent-level)
   ((and (derived-mode-p 'js2-mode) (boundp 'js2-basic-offset))
    js2-basic-offset)
   ((and (derived-mode-p 'typescript-ts-base-mode)
	 (boundp 'typescript-ts-mode-indent-offset))
    typescript-ts-mode-indent-offset)
   ((and (derived-mode-p 'sws-mode) (boundp 'sws-tab-width))
    sws-tab-width)
   ((and (derived-mode-p 'web-mode) (boundp 'web-mode-markup-indent-offset))
    web-mode-markup-indent-offset)
   ((and (derived-mode-p 'web-mode) (boundp 'web-mode-html-offset)) ; old var
    web-mode-html-offset)
   ((and (local-variable-p 'c-basic-offset) (numberp c-basic-offset))
    c-basic-offset)
   ((and (local-variable-p 'c-ts-common-indent-offset)
	 (symbolp c-ts-common-indent-offset)
	 (numberp (symbol-value c-ts-common-indent-offset)))
    (symbol-value c-ts-common-indent-offset))
   ((and (derived-mode-p 'yaml-pro-mode) (boundp 'yaml-pro-indent)
	 yaml-pro-indent)
    yaml-pro-indent)
   ((and (derived-mode-p 'yaml-pro-ts-mode) (boundp 'yaml-pro-ts-indent))
    yaml-pro-ts-indent)
   ((and (derived-mode-p 'yaml-mode) (boundp 'yaml-indent-offset))
    yaml-indent-offset)
   ((and (derived-mode-p 'elixir-mode) (boundp 'elixir-smie-indent-basic))
    elixir-smie-indent-basic)
   ((and (derived-mode-p 'lisp-data-mode) (boundp 'lisp-body-indent))
    lisp-body-indent)
   ((and (derived-mode-p 'cobol-mode) (boundp 'cobol-tab-width))
    cobol-tab-width)
   ((or (derived-mode-p 'go-ts-mode) (derived-mode-p 'go-mode))
    tab-width)
   ((derived-mode-p 'nix-mode)
    tab-width)
   ((derived-mode-p 'makefile-mode)
    tab-width)
   ((and (derived-mode-p 'nix-ts-mode) (boundp 'nix-ts-mode-indent-offset))
    nix-ts-mode-indent-offset)
   ((and (derived-mode-p 'json-ts-mode) (boundp 'json-ts-mode-indent-offset))
    json-ts-mode-indent-offset)
   ((and (derived-mode-p 'json-mode) (boundp 'js-indent-level))
    js-indent-level)
   ((and (derived-mode-p 'sh-base-mode) (boundp 'sh-basic-offset))
    sh-basic-offset)
   ((and (derived-mode-p 'java-ts-mode) (boundp 'java-ts-mode-indent-offset))
    java-ts-mode-indent-offset)
   ((and (derived-mode-p 'tcl-mode) (boundp 'tcl-indent-level))
    tcl-indent-level)
   ((and (derived-mode-p 'haml-mode) (boundp 'haml-indent-offset))
    haml-indent-offset)
   ((and (derived-mode-p 'r-ts-mode) (boundp 'r-ts-mode-indent-offset))
    r-ts-mode-indent-offset)
   ((and (derived-mode-p 'r-ts-mode) (boundp 'r-ts-mode-indent-level))
    r-ts-mode-indent-level)
   ((and (derived-mode-p 'ess-mode) (boundp 'ess-indent-offset))
    ess-indent-offset)
   ((and (boundp 'standard-indent) standard-indent))
   (t 4)))                              ; backup