From: Yuan Fu Date: Tue, 29 Oct 2024 07:27:34 +0000 (-0700) Subject: Fix c-ts-common-comment-indent-new-line (bug#73900) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=345077a4667ae4c0e3df443b3dd0beb1eba73753;p=emacs.git Fix c-ts-common-comment-indent-new-line (bug#73900) * lisp/progmodes/c-ts-common.el: (c-ts-common-comment-indent-new-line): Delete trailing whitespace before inserting newline. The insert-line-break function is the same as in c-indent-new-comment-line. (cherry picked from commit e6a8492fabc1e7065983fbf6506a2790c137cd9f) --- diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 64ae5753d2b..cf55ddea8f7 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -128,8 +128,8 @@ ARG is passed to `fill-paragraph'." (looking-at "//")) ;; In rust, NODE will be the body of a comment, and the ;; parent will be the whole comment. - (if-let ((start (treesit-node-start - (treesit-node-parent node)))) + (if-let* ((start (treesit-node-start + (treesit-node-parent node)))) (save-excursion (goto-char start) (looking-at "//")))) @@ -336,7 +336,7 @@ and /* */ comments. SOFT works the same as in (delete-horizontal-space) (if soft (insert-and-inherit ?\n) - (newline (if allow-auto-fill nil 1)))))) + (newline 1))))) (cond ;; Line starts with //, or ///, or ////... ;; Or //! (used in rust).