diff options
| author | Yuan Fu | 2025-02-17 13:29:46 -0800 |
|---|---|---|
| committer | Yuan Fu | 2025-02-17 13:38:15 -0800 |
| commit | 237afc82b2ed147fe6b1773df303c448ded9679b (patch) | |
| tree | 01ba8a5d84bdd936242d2036945cba211667a97e | |
| parent | 928bad93609773ca5e9c94cf6e8f24e895e263d3 (diff) | |
| download | emacs-237afc82b2ed147fe6b1773df303c448ded9679b.tar.gz emacs-237afc82b2ed147fe6b1773df303c448ded9679b.zip | |
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.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/treesit.el | 2 | ||||
| -rw-r--r-- | test/src/treesit-tests.el | 10 |
3 files changed, 7 insertions, 7 deletions
| @@ -1426,7 +1426,7 @@ at point to explore. | |||
| 1426 | *** New variable 'treesit-aggregated-simple-imenu-settings'. | 1426 | *** New variable 'treesit-aggregated-simple-imenu-settings'. |
| 1427 | This variable allows major modes to setup Imenu for multiple languages. | 1427 | This variable allows major modes to setup Imenu for multiple languages. |
| 1428 | 1428 | ||
| 1429 | *** New function 'treesit-add-simple-indent-rules'. | 1429 | *** New function 'treesit-simple-indent-add-rules'. |
| 1430 | This new function makes it easier to customize indent rules for | 1430 | This new function makes it easier to customize indent rules for |
| 1431 | tree-sitter modes. | 1431 | tree-sitter modes. |
| 1432 | 1432 | ||
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." | |||
| 2508 | offset))))) | 2508 | offset))))) |
| 2509 | (cons lang (mapcar #'optimize-rule indent-rules))))) | 2509 | (cons lang (mapcar #'optimize-rule indent-rules))))) |
| 2510 | 2510 | ||
| 2511 | (defun treesit-add-simple-indent-rules (language rules &optional where anchor) | 2511 | (defun treesit-simple-indent-add-rules (language rules &optional where anchor) |
| 2512 | "Add simple indent RULES for LANGUAGE. | 2512 | "Add simple indent RULES for LANGUAGE. |
| 2513 | 2513 | ||
| 2514 | This function only affects `treesit-simple-indent-rules', | 2514 | 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." | |||
| 413 | 413 | ||
| 414 | ;;; Indent | 414 | ;;; Indent |
| 415 | 415 | ||
| 416 | (ert-deftest treesit-test-add-simple-indent-rules () | 416 | (ert-deftest treesit-test-simple-indent-add-rules () |
| 417 | "Test `treesit-add-simple-indent-rules'." | 417 | "Test `treesit-add-simple-indent-rules'." |
| 418 | (let ((treesit-simple-indent-rules | 418 | (let ((treesit-simple-indent-rules |
| 419 | (copy-tree '((c (a a a) (b b b) (c c c)))))) | 419 | (copy-tree '((c (a a a) (b b b) (c c c)))))) |
| 420 | (treesit-add-simple-indent-rules 'c '((d d d))) | 420 | (treesit-simple-indent-add-rules 'c '((d d d))) |
| 421 | (should (equal treesit-simple-indent-rules | 421 | (should (equal treesit-simple-indent-rules |
| 422 | '((c (d d d) (a a a) (b b b) (c c c))))) | 422 | '((c (d d d) (a a a) (b b b) (c c c))))) |
| 423 | (treesit-add-simple-indent-rules 'c '((e e e)) :after) | 423 | (treesit-simple-indent-add-rules 'c '((e e e)) :after) |
| 424 | (should (equal treesit-simple-indent-rules | 424 | (should (equal treesit-simple-indent-rules |
| 425 | '((c (d d d) (a a a) (b b b) (c c c) (e e e))))) | 425 | '((c (d d d) (a a a) (b b b) (c c c) (e e e))))) |
| 426 | (treesit-add-simple-indent-rules 'c '((f f f)) :after '(b b b)) | 426 | (treesit-simple-indent-add-rules 'c '((f f f)) :after '(b b b)) |
| 427 | (should (equal treesit-simple-indent-rules | 427 | (should (equal treesit-simple-indent-rules |
| 428 | '((c (d d d) (a a a) (b b b) (f f f) | 428 | '((c (d d d) (a a a) (b b b) (f f f) |
| 429 | (c c c) (e e e))))) | 429 | (c c c) (e e e))))) |
| 430 | (treesit-add-simple-indent-rules 'c '((g g g)) :before '(b b b)) | 430 | (treesit-simple-indent-add-rules 'c '((g g g)) :before '(b b b)) |
| 431 | (should (equal treesit-simple-indent-rules | 431 | (should (equal treesit-simple-indent-rules |
| 432 | '((c (d d d) (a a a) (g g g) | 432 | '((c (d d d) (a a a) (g g g) |
| 433 | (b b b) (f f f) (c c c) (e e e))))))) | 433 | (b b b) (f f f) (c c c) (e e e))))))) |