]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix c-ts-common-comment-indent-new-line (bug#73900)
authorYuan Fu <casouri@gmail.com>
Tue, 29 Oct 2024 07:27:34 +0000 (00:27 -0700)
committerEshel Yaron <me@eshelyaron.com>
Tue, 5 Nov 2024 11:13:10 +0000 (12:13 +0100)
* 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)

lisp/progmodes/c-ts-common.el

index 64ae5753d2bd425ccbaa98a0e85e8e31af5f5744..cf55ddea8f745e5fefd14609847a4a055aee0b54 100644 (file)
@@ -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).