From 3d1e74c82a84d9b2c5ad45a377512b5ee83b8d47 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 16 Jan 2023 00:23:47 -0800 Subject: [PATCH] Fix tree-sitter indent preset function (bug#60270) * lisp/treesit.el (treesit-simple-indent-presets): Fix prev-adaptive-prefix so it doesn't return nil if the previous line has no prefix. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test. --- lisp/treesit.el | 1 - .../lisp/progmodes/c-ts-mode-resources/indent.erts | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index ffc78b93032..5e6f109531e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1152,7 +1152,6 @@ See `treesit-simple-indent-presets'.") (and (>= (point) comment-start-bol) adaptive-fill-regexp (looking-at adaptive-fill-regexp) - (> (match-end 0) (match-beginning 0)) (match-end 0)))))) ;; TODO: Document. (cons 'grand-parent diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 71524e273f3..70fce68b0ec 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -133,6 +133,20 @@ Name: Multiline Block Comments 4 (bug#60270) */ =-=-= +Name: Multiline Block Comments 5 (bug#60270) + +=-= +/* +line one +line 2 + */ +=-= +/* + line one + line 2 + */ +=-=-= + Code: (lambda () -- 2.39.5