From: Theodor Thornhill Date: Fri, 20 Jan 2023 21:37:47 +0000 (+0100) Subject: Use point-min to anchor top-level constructs (bug#60602) X-Git-Tag: emacs-29.0.90~639 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d63e1a89518338bc3450b11d6c2d4644cb0440e1;p=emacs.git 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. --- diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 5749e568185..b13e2036f4f 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -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) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index d909a366e5d..8251d9603c3 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -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) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 2a7d850c3e3..ac0b5d7c6d4 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -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. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 6aaa852895c..903be93422d 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -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)