aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2023-04-22 09:41:50 +0300
committerEli Zaretskii2023-04-22 09:41:50 +0300
commit44145bf07e296efe28a29f03edcb685c84afe69a (patch)
tree58bce88242a92698b773266705e9ca5a842e98a9 /lisp
parente7db6c59cc63c28c6be8989968fb1a8b6a7a5ca4 (diff)
downloademacs-44145bf07e296efe28a29f03edcb685c84afe69a.tar.gz
emacs-44145bf07e296efe28a29f03edcb685c84afe69a.zip
Add indentation style setting for c-ts-mode in .dir-locals.el
* lisp/progmodes/c-ts-mode.el (c-ts-indent-style-safep): New predicate. (c-ts-mode-indent-style): Use it to test the value for being safe. * .dir-locals.el (c-ts-mode): Set 'c-ts-mode-indent-style' to 'gnu'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/c-ts-mode.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 166399f922d..6100f00e3ba 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -136,6 +136,10 @@ symbol."
136 (loop (append res (list buffer)) (cdr buffers)) 136 (loop (append res (list buffer)) (cdr buffers))
137 (loop res (cdr buffers)))))))) 137 (loop res (cdr buffers))))))))
138 138
139(defun c-ts-indent-style-safep (style)
140 "Non-nil if STYLE's value is safe for file-local variables."
141 (and (symbolp style) (not (functionp style))))
142
139(defcustom c-ts-mode-indent-style 'gnu 143(defcustom c-ts-mode-indent-style 'gnu
140 "Style used for indentation. 144 "Style used for indentation.
141 145
@@ -150,6 +154,7 @@ follows the form of `treesit-simple-indent-rules'."
150 (symbol :tag "BSD" bsd) 154 (symbol :tag "BSD" bsd)
151 (function :tag "A function for user customized style" ignore)) 155 (function :tag "A function for user customized style" ignore))
152 :set #'c-ts-mode--indent-style-setter 156 :set #'c-ts-mode--indent-style-setter
157 :safe 'c-ts-indent-style-safep
153 :group 'c) 158 :group 'c)
154 159
155(defun c-ts-mode--get-indent-style (mode) 160(defun c-ts-mode--get-indent-style (mode)