Rename treesit-add-simple-indent-rules

* lisp/treesit.el (treesit-add-simple-indent-rules): Rename to
treesit-simple-indent-add-rules.
* etc/NEWS: Update.
* test/src/treesit-tests.el:
(treesit-test-simple-indent-add-rules): Update accordingly.
This commit is contained in:
Yuan Fu 2025-02-17 13:29:46 -08:00
parent 928bad9360
commit 237afc82b2
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
3 changed files with 7 additions and 7 deletions

View file

@ -1426,7 +1426,7 @@ at point to explore.
*** New variable 'treesit-aggregated-simple-imenu-settings'.
This variable allows major modes to setup Imenu for multiple languages.
*** New function 'treesit-add-simple-indent-rules'.
*** New function 'treesit-simple-indent-add-rules'.
This new function makes it easier to customize indent rules for
tree-sitter modes.

View file

@ -2508,7 +2508,7 @@ RULES."
offset)))))
(cons lang (mapcar #'optimize-rule indent-rules)))))
(defun treesit-add-simple-indent-rules (language rules &optional where anchor)
(defun treesit-simple-indent-add-rules (language rules &optional where anchor)
"Add simple indent RULES for LANGUAGE.
This function only affects `treesit-simple-indent-rules',

View file

@ -413,21 +413,21 @@ BODY is the test body."
;;; Indent
(ert-deftest treesit-test-add-simple-indent-rules ()
(ert-deftest treesit-test-simple-indent-add-rules ()
"Test `treesit-add-simple-indent-rules'."
(let ((treesit-simple-indent-rules
(copy-tree '((c (a a a) (b b b) (c c c))))))
(treesit-add-simple-indent-rules 'c '((d d d)))
(treesit-simple-indent-add-rules 'c '((d d d)))
(should (equal treesit-simple-indent-rules
'((c (d d d) (a a a) (b b b) (c c c)))))
(treesit-add-simple-indent-rules 'c '((e e e)) :after)
(treesit-simple-indent-add-rules 'c '((e e e)) :after)
(should (equal treesit-simple-indent-rules
'((c (d d d) (a a a) (b b b) (c c c) (e e e)))))
(treesit-add-simple-indent-rules 'c '((f f f)) :after '(b b b))
(treesit-simple-indent-add-rules 'c '((f f f)) :after '(b b b))
(should (equal treesit-simple-indent-rules
'((c (d d d) (a a a) (b b b) (f f f)
(c c c) (e e e)))))
(treesit-add-simple-indent-rules 'c '((g g g)) :before '(b b b))
(treesit-simple-indent-add-rules 'c '((g g g)) :before '(b b b))
(should (equal treesit-simple-indent-rules
'((c (d d d) (a a a) (g g g)
(b b b) (f f f) (c c c) (e e e)))))))