[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/devicetree-ts-mode fecea965dc 03/11: Add indent rules.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/devicetree-ts-mode fecea965dc 03/11: Add indent rules. |
Date: |
Tue, 16 Jan 2024 03:58:28 -0500 (EST) |
branch: externals/devicetree-ts-mode
commit fecea965dc00e30284cfaecfe9a2e740898a0922
Author: Aleksandr Vityazev <avityazew@gmail.com>
Commit: Aleksandr Vityazev <avityazew@gmail.com>
Add indent rules.
---
devicetree-ts-mode.el | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/devicetree-ts-mode.el b/devicetree-ts-mode.el
index db053323ba..2e1544934b 100644
--- a/devicetree-ts-mode.el
+++ b/devicetree-ts-mode.el
@@ -1,9 +1,12 @@
-;;; devicetree-ts-mode.el --- tree-sitter support for DTS -*-
lexical-binding: t; -*-
+;;; devicetree-ts-mode.el --- Tree-sitter support for DTS -*-
lexical-binding: t; -*-
;; Copyright (C) 2023 Aleksandr Vityazev
;; Author: Aleksandr Vityazev <avityazew@gmail.com>
-;; Keywords: devicetree tree-sitter
+;; Keywords: languages devicetree tree-sitter
+;; Version: 0.1
+;; Homepage: https://sr.ht/~akagi/devicetree-ts-mode
+;; Package-Requires: ((emacs "29.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -35,6 +38,13 @@
;; (declare-function treesit-node-start "treesit.c")
;; (declare-function treesit-node-type "treesit.c")
+(defcustom devicetree-ts-mode-indent-offset 4
+ "Number of spaces for each indentation step in `devicetree-ts-mode'."
+ :version "29.1"
+ :type 'natnum
+ :safe 'natnump
+ :group 'devicetree)
+
;; Taken from the dts-mode
(defvar devicetree-ts-mode--syntax-table
(let ((table (make-syntax-table)))
@@ -63,6 +73,21 @@
table)
"Syntax table for `devicetree-ts-mode'.")
+(defvar devicetree-ts-mode--indent-rules
+ (let ((offset devicetree-ts-mode-indent-offset))
+ `((devicetree
+ ((node-is ">") parent-bol 0)
+ ((node-is "]") parent-bol 0)
+ ((node-is "}") standalone-parent 0)
+ ((node-is "]") parent-bol 0)
+ ((and (parent-is "comment") c-ts-common-looking-at-star)
+ c-ts-common-comment-start-after-first-star -1)
+ ((parent-is "node") parent-bol ,offset)
+ ((parent-is "property") parent-bol ,offset)
+ ((parent-is "integer_cells") parent-bol ,offset)
+ (no-node parent-bol 0))))
+ "Tree-sitter indent rules for `devicetree-ts-mode'.")
+
(defvar devicetree-ts-mode--treesit-keywords
'("/delete-node/" "/delete-property/" "#define" "#include"
"/omit-if-no-ref/" "/dts-v1/"))
@@ -158,8 +183,8 @@
(setq-local which-func-functions nil)
;; Indent.
- ;; (setq-local treesit-simple-indent-rules
- ;; devicetree-ts-mode--indent-rules)
+ (setq-local treesit-simple-indent-rules
+ devicetree-ts-mode--indent-rules)
;; (setq-local indent-tabs-mode t)
;; Electric
- [elpa] branch externals/devicetree-ts-mode created (now bc07c11245), ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode bf3a235f5d 02/11: Add imenu support., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 2bbac87f33 04/11: Add README, update guix.scm., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 8d6bd50276 07/11: Remove duplication in devicetree-ts-mode--indent-rules., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 8a4e9b11fc 10/11: Enhance README, update headers for ELPA., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 36305b7dcf 06/11: Change indentation for integer_cells., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode fecea965dc 03/11: Add indent rules.,
ELPA Syncer <=
- [elpa] externals/devicetree-ts-mode 228527f661 08/11: Enhance devicetree-ts--mode--name-function., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 4fec42c9ae 09/11: Update font-lock settings., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode b22c92ed8e 05/11: Require c-ts-common., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode 5343ac48ec 01/11: Initial commit., ELPA Syncer, 2024/01/16
- [elpa] externals/devicetree-ts-mode bc07c11245 11/11: Version 0.3, ELPA Syncer, 2024/01/16