Function: c-ts-mode-set-style

c-ts-mode-set-style is an interactive and byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode-set-style STYLE)

Documentation

Set the C/C++ indent style of the current buffer to STYLE.

To set the default indent style globally, use c-ts-mode-set-global-style.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode-set-style (style)
  "Set the C/C++ indent style of the current buffer to STYLE.

To set the default indent style globally, use
`c-ts-mode-set-global-style'."
  (interactive (list (c-ts-mode--prompt-for-style)))
  (if (not (derived-mode-p '(c-ts-mode c++-ts-mode)))
      (user-error "The current buffer is not in `c-ts-mode' nor `c++-ts-mode'")
    (setq-local c-ts-mode-indent-style style)
    (setq treesit-simple-indent-rules
          (if (functionp style)
              (funcall style)
            (c-ts-mode--simple-indent-rules
             (if (derived-mode-p 'c-ts-mode) 'c 'cpp)
             style)))))