Use point-min to anchor top-level constructs (bug#60602)

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New anchor.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): New
anchor.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules): New anchor.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): New anchor.
This commit is contained in:
Theodor Thornhill 2023-01-20 22:37:47 +01:00
parent 3479333778
commit d63e1a8951
4 changed files with 4 additions and 4 deletions

View file

@ -167,7 +167,7 @@ delimiters < and >'s."
"Indent rules supported by `c-ts-mode'.
MODE is either `c' or `cpp'."
(let ((common
`(((parent-is "translation_unit") parent-bol 0)
`(((parent-is "translation_unit") point-min 0)
((node-is ")") parent 1)
((node-is "]") parent-bol 0)
((node-is "else") parent-bol 0)

View file

@ -69,7 +69,7 @@
(defvar java-ts-mode--indent-rules
`((java
((parent-is "program") parent-bol 0)
((parent-is "program") point-min 0)
((node-is "}") (and parent parent-bol) 0)
((node-is ")") parent-bol 0)
((node-is "]") parent-bol 0)

View file

@ -555,7 +555,7 @@ a statement container is a node that matches
(let ((common
`(
;; Slam all top level nodes to the left margin
((parent-is "program") parent 0)
((parent-is "program") point-min 0)
;; Do not indent here docs or the end. Not sure why it
;; takes the grand-parent but ok fine.

View file

@ -69,7 +69,7 @@
"Rules used for indentation.
Argument LANGUAGE is either `typescript' or `tsx'."
`((,language
((parent-is "program") parent-bol 0)
((parent-is "program") point-min 0)
((node-is "}") parent-bol 0)
((node-is ")") parent-bol 0)
((node-is "]") parent-bol 0)