aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Fu2023-01-09 21:46:07 -0800
committerYuan Fu2023-01-09 21:46:07 -0800
commit55aabfea4accd04aed9424b5cdbe304d12be6224 (patch)
tree73d1bd061953fd327b81932a8b0d78d3051dcaab
parent8377ed5298f0529512294956269dcd06a8e6ed18 (diff)
downloademacs-55aabfea4accd04aed9424b5cdbe304d12be6224.tar.gz
emacs-55aabfea4accd04aed9424b5cdbe304d12be6224.zip
Fix c-ts-mode comment indent
* lisp/progmodes/c-ts-mode.el: (c-ts-mode--comment-2nd-line-matcher): Also make sure PARENT is a comment node.
-rw-r--r--lisp/progmodes/c-ts-mode.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 898b89b9fce..5c7df4b2141 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -246,10 +246,11 @@ Assumes PARENT is a comment node."
246(defun c-ts-mode--comment-2nd-line-matcher (_n parent &rest _) 246(defun c-ts-mode--comment-2nd-line-matcher (_n parent &rest _)
247 "Matches if point is at the second line of a block comment. 247 "Matches if point is at the second line of a block comment.
248PARENT should be a comment node." 248PARENT should be a comment node."
249 (save-excursion 249 (and (equal (treesit-node-type parent) "comment")
250 (forward-line -1) 250 (save-excursion
251 (back-to-indentation) 251 (forward-line -1)
252 (eq (point) (treesit-node-start parent)))) 252 (back-to-indentation)
253 (eq (point) (treesit-node-start parent)))))
253 254
254(defun c-ts-mode--comment-2nd-line-anchor (&rest _) 255(defun c-ts-mode--comment-2nd-line-anchor (&rest _)
255 "Return appropriate anchor for the second line of a comment. 256 "Return appropriate anchor for the second line of a comment.