emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 55aabfea4a 2/2: Fix c-ts-mode comment indent


From: Yuan Fu
Subject: emacs-29 55aabfea4a 2/2: Fix c-ts-mode comment indent
Date: Tue, 10 Jan 2023 00:46:56 -0500 (EST)

branch: emacs-29
commit 55aabfea4accd04aed9424b5cdbe304d12be6224
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    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.
---
 lisp/progmodes/c-ts-mode.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 898b89b9fc..5c7df4b214 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."
 (defun c-ts-mode--comment-2nd-line-matcher (_n parent &rest _)
   "Matches if point is at the second line of a block comment.
 PARENT should be a comment node."
-  (save-excursion
-    (forward-line -1)
-    (back-to-indentation)
-    (eq (point) (treesit-node-start parent))))
+  (and (equal (treesit-node-type parent) "comment")
+       (save-excursion
+         (forward-line -1)
+         (back-to-indentation)
+         (eq (point) (treesit-node-start parent)))))
 
 (defun c-ts-mode--comment-2nd-line-anchor (&rest _)
   "Return appropriate anchor for the second line of a comment.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]