Function: php-ts-mode-set-style

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

Signature

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

Documentation

Set the PHP indent style of the current buffer to STYLE.

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

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
(defun php-ts-mode-set-style (style)
  "Set the PHP indent style of the current buffer to STYLE.
To set the default indent style globally, use
`php-ts-mode-set-global-style'."
  (interactive (list (php-ts-mode--prompt-for-style)))
  (cond
   ((not (derived-mode-p 'php-ts-mode))
    (user-error "The current buffer is not in `php-ts-mode'"))
   ((equal php-ts-mode-indent-style style)
    (message "The style is already %s" style));; nothing to do
   (t (progn
	(setq-local php-ts-mode-indent-style style)
	(php-ts-mode--set-indent-property style)
	(let ((rules (assq-delete-all 'php treesit-simple-indent-rules))
	      (new-style (car (treesit--indent-rules-optimize
			       (php-ts-mode--get-indent-style)))))
	  (setq treesit-simple-indent-rules (cons new-style rules))
	  (message "Switch to %s style" style))))))