diff options
author | Yuan Fu <casouri@gmail.com> | 2023-03-04 01:09:00 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2023-03-04 01:20:02 -0800 |
commit | 4c16fd3a51286e1b1685bfb28e0cd6ae2358c37d (patch) | |
tree | ab4ad617437865d73c3587a712edda4f41ba7d5e /lisp/progmodes/c-ts-mode.el | |
parent | f47b39301589feb2cb846a3c62f94411d993be78 (diff) | |
download | emacs-4c16fd3a51286e1b1685bfb28e0cd6ae2358c37d.tar.gz emacs-4c16fd3a51286e1b1685bfb28e0cd6ae2358c37d.tar.bz2 emacs-4c16fd3a51286e1b1685bfb28e0cd6ae2358c37d.zip |
Change tree-sitter indent anchor 'point-min' to 'column-0'
Point-min isn't necessarily at column 0, using line-beginning-position
is better. column-0 is also more intuitive.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles):
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules):
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode--indent-rules): Change point-min to column-0.
* lisp/treesit.el (treesit-simple-indent-presets): Change point-min to
column-0.
Diffstat (limited to 'lisp/progmodes/c-ts-mode.el')
-rw-r--r-- | lisp/progmodes/c-ts-mode.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index eb07eb74676..05c471e6fb4 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -309,8 +309,8 @@ PARENT, BOL, ARGS are the same as other anchor functions." "Indent rules supported by `c-ts-mode'. MODE is either `c' or `cpp'." (let ((common - `(((parent-is "translation_unit") point-min 0) - ((query "(ERROR (ERROR)) @indent") point-min 0) + `(((parent-is "translation_unit") column-0 0) + ((query "(ERROR (ERROR)) @indent") column-0 0) ((node-is ")") parent 1) ((node-is "]") parent-bol 0) ((node-is "else") parent-bol 0) @@ -330,11 +330,11 @@ MODE is either `c' or `cpp'." ((parent-is "labeled_statement") c-ts-mode--standalone-grandparent c-ts-mode-indent-offset) - ((node-is "preproc") point-min 0) - ((node-is "#endif") point-min 0) - ((match "preproc_call" "compound_statement") point-min 0) + ((node-is "preproc") column-0 0) + ((node-is "#endif") column-0 0) + ((match "preproc_call" "compound_statement") column-0 0) - ((n-p-gp nil "preproc" "translation_unit") point-min 0) + ((n-p-gp nil "preproc" "translation_unit") column-0 0) ((n-p-gp nil "\n" "preproc") great-grand-parent c-ts-mode--preproc-offset) ((parent-is "preproc") grand-parent c-ts-mode-indent-offset) @@ -392,14 +392,14 @@ MODE is either `c' or `cpp'." `((gnu ;; Prepend rules to set highest priority ((match "while" "do_statement") parent 0) - (c-ts-mode--top-level-label-matcher point-min 1) + (c-ts-mode--top-level-label-matcher column-0 1) ,@common) (k&r ,@common) (linux ;; Reference: ;; https://www.kernel.org/doc/html/latest/process/coding-style.html, ;; and script/Lindent in Linux kernel repository. - ((node-is "labeled_statement") point-min 0) + ((node-is "labeled_statement") column-0 0) ,@common) (bsd ((node-is "}") parent-bol 0) |