summaryrefslogtreecommitdiff
path: root/lisp/progmodes/c-ts-mode.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-04-22 09:41:50 +0300
committerEli Zaretskii <eliz@gnu.org>2023-04-22 09:41:50 +0300
commit44145bf07e296efe28a29f03edcb685c84afe69a (patch)
tree58bce88242a92698b773266705e9ca5a842e98a9 /lisp/progmodes/c-ts-mode.el
parente7db6c59cc63c28c6be8989968fb1a8b6a7a5ca4 (diff)
downloademacs-44145bf07e296efe28a29f03edcb685c84afe69a.tar.gz
emacs-44145bf07e296efe28a29f03edcb685c84afe69a.tar.bz2
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/progmodes/c-ts-mode.el')
-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."
(loop (append res (list buffer)) (cdr buffers))
(loop res (cdr buffers))))))))
+(defun c-ts-indent-style-safep (style)
+ "Non-nil if STYLE's value is safe for file-local variables."
+ (and (symbolp style) (not (functionp style))))
+
(defcustom c-ts-mode-indent-style 'gnu
"Style used for indentation.
@@ -150,6 +154,7 @@ follows the form of `treesit-simple-indent-rules'."
(symbol :tag "BSD" bsd)
(function :tag "A function for user customized style" ignore))
:set #'c-ts-mode--indent-style-setter
+ :safe 'c-ts-indent-style-safep
:group 'c)
(defun c-ts-mode--get-indent-style (mode)