From: Yuan Fu Date: Mon, 16 Jan 2023 08:23:47 +0000 (-0800) Subject: Fix tree-sitter indent preset function (bug#60270) X-Git-Tag: emacs-29.0.90~711 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d1e74c82a84d9b2c5ad45a377512b5ee83b8d47;p=emacs.git 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. --- 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 ()