[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 44145bf07e2: Add indentation style setting for c-ts-mode in .di
From: |
Eli Zaretskii |
Subject: |
emacs-29 44145bf07e2: Add indentation style setting for c-ts-mode in .dir-locals.el |
Date: |
Sat, 22 Apr 2023 02:42:56 -0400 (EDT) |
branch: emacs-29
commit 44145bf07e296efe28a29f03edcb685c84afe69a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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'.
---
.dir-locals.el | 3 ++-
lisp/progmodes/c-ts-mode.el | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/.dir-locals.el b/.dir-locals.el
index 6733b5326a6..0bcded4b5d1 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -21,7 +21,8 @@
(electric-quote-comment . nil)
(electric-quote-string . nil)
(mode . bug-reference-prog)))
- (c-ts-mode . ((indent-tabs-mode . t)
+ (c-ts-mode . ((c-ts-mode-indent-style . gnu)
+ (indent-tabs-mode . t)
(mode . bug-reference-prog)))
(log-edit-mode . ((log-edit-font-lock-gnu-style . t)
(log-edit-setup-add-author . t)
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 44145bf07e2: Add indentation style setting for c-ts-mode in .dir-locals.el,
Eli Zaretskii <=