diff --git a/lisp/treesit.el b/lisp/treesit.el index 18a6131b71d..c37e7b6b5b7 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1217,8 +1217,10 @@ See `treesit-simple-indent-presets'.") (goto-char bol) (setq this-line-has-prefix - (and (looking-at adaptive-fill-regexp) - (match-string 1))) + (and (looking-at-p adaptive-fill-regexp) + (not (string-match-p + (rx bos (* whitespace) eos) + (match-string 0))))) (forward-line -1) (and (>= (point) comment-start-bol) @@ -1226,7 +1228,7 @@ See `treesit-simple-indent-presets'.") (looking-at adaptive-fill-regexp) ;; If previous line is an empty line, don't ;; indent. - (not (looking-at (rx (* whitespace) eol))) + (not (looking-at-p (rx (* whitespace) eol))) ;; Return the anchor. If the indenting line ;; has a prefix and the previous line also ;; has a prefix, indent to the beginning of