[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 757c2c2592 2/4: Fix c-ts-mode--looking-at-star
From: |
Yuan Fu |
Subject: |
emacs-29 757c2c2592 2/4: Fix c-ts-mode--looking-at-star |
Date: |
Sat, 7 Jan 2023 19:14:33 -0500 (EST) |
branch: emacs-29
commit 757c2c25922e9c9dea33dd34f0112b631ea5c208
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Fix c-ts-mode--looking-at-star
Not the topic of bug#60270 but reported in one of the replies.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--looking-at-star): Check not
the character after point but character after BOL. Otherwise
indentation is wrong when point is not at BOL.
---
lisp/progmodes/c-ts-mode.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index b8c4313c0f..a6ab454012 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -205,11 +205,13 @@ beginning of grandparent."
(treesit-node-parent parent)
parent)))))
-(defun c-ts-mode--looking-at-star (&rest _)
+(defun c-ts-mode--looking-at-star (_n _p bol &rest _)
"A tree-sitter simple indent matcher.
Matches if there is a \"*\" after point (ignoring whitespace in
between)."
- (looking-at (rx (* (syntax whitespace)) "*")))
+ (save-excursion
+ (goto-char bol)
+ (looking-at (rx (* (syntax whitespace)) "*"))))
(defun c-ts-mode--comment-start-after-first-star (_n parent &rest _)
"A tree-sitter simple indent anchor.