From b435656157405ea0555fdff512483593073179f7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 22 Jun 2025 11:16:53 +0300 Subject: [PATCH] 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) (cherry picked from commit 081c1aae992549bc9ef6f0f85c4d4cf6a8fe84cb) --- lisp/progmodes/c-ts-mode.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 0df9fe39e36..5155193c603 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -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 -- 2.39.5