1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix 'c-ts-mode' indentation when the style is defined as a function

* lisp/progmodes/c-ts-mode.el (c-ts-mode, c++-ts-mode): Handle the
case where 'c-ts-mode-indent-style' is a function.  (Bug#78814)
This commit is contained in:
Eli Zaretskii 2025-06-22 11:16:53 +03:00
parent e66428a0d2
commit 081c1aae99

View file

@ -1487,8 +1487,10 @@ in your init files."
(setq-local comment-end " */")
;; Indent.
(setq-local treesit-simple-indent-rules
(c-ts-mode--simple-indent-rules
'c c-ts-mode-indent-style))
(if (functionp c-ts-mode-indent-style)
(funcall c-ts-mode-indent-style)
(c-ts-mode--simple-indent-rules
'c c-ts-mode-indent-style)))
;; (setq-local treesit-simple-indent-rules
;; `((c . ,(alist-get 'gnu (c-ts-mode--indent-styles 'c)))))
;; Font-lock.
@ -1560,8 +1562,10 @@ recommended to enable `electric-pair-mode' with this mode."
;; Indent.
(setq-local treesit-simple-indent-rules
(c-ts-mode--simple-indent-rules
'cpp c-ts-mode-indent-style))
(if (functionp c-ts-mode-indent-style)
(funcall c-ts-mode-indent-style)
(c-ts-mode--simple-indent-rules
'cpp c-ts-mode-indent-style)))
;; Font-lock.
(setq-local treesit-font-lock-settings