diff --git a/etc/NEWS b/etc/NEWS index 95606658a1d..ef491edf624 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/lisp/treesit.el b/lisp/treesit.el index efc3b153ee8..30efd4d4599 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -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', diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index 8b24c5eb1fc..caacb74315d 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el @@ -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)))))))