From: Yuan Fu <casouri@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Eli Zaretskii <eliz@gnu.org>,
Michael Kleehammer <michael@kleehammer.com>,
73900@debbugs.gnu.org
Subject: bug#73900: 30.0.91; auto-fill adds extra space in js-ts-mode
Date: Tue, 29 Oct 2024 00:33:05 -0700 [thread overview]
Message-ID: <5F76FC01-BE2F-47CC-BA7A-4F77A2F4E41A@gmail.com> (raw)
In-Reply-To: <eb499338-b47e-4626-94cc-d38acafefee5@gutov.dev>
> On Oct 27, 2024, at 8:10 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
>
> On 27/10/2024 12:55, Eli Zaretskii wrote:
>>> From: Michael Kleehammer<michael@kleehammer.com>
>>> Date: Sat, 19 Oct 2024 22:46:55 -0500
>>>
>>> In Emacs 30, js-ts-mode auto-fill chooses an incorrect prefix when
>>> wrapping comments.
>>>
>>> 1) emacs -Q
>>>
>>> 2) In the scratch buffer:
>>> a) M-x js-ts-mode
>>> b) M-x auto-fill-mode
>>> c) M-x erase-buffer
>>> 3) Paste in a long JS comment:
>>>
>>> // This buffer is for text that is not saved, and for Lisp evaluation. To create a file, visit it
>>>
>>> 4) At end of line, press <Space>.
>>>
>>> The text wraps like so:
>>>
>>> // This buffer is for text that is not saved, and for Lisp evaluation.
>>> // To create a file, visit it
>>>
>>> In previous versions, it would wrap like so:
>>>
>>> // This buffer is for text that is not saved, and for Lisp evaluation.
>>> // To create a file, visit it
>> Adding people who know about js-ts-mode, in the hope they will have
>> comments or suggestions.
>
> I suppose the answer is somewhere around the fact that we have both normal-auto-fill-function and fill-paragraph-function, and that js-ts-mode (through c-ts-common-comment-setup) only configures the latter, while js-mode (in js--mode-setup) has settings for both.
>
> Not sure why the default do-auto-fill doesn't skip over the space, though.
Ok, so the actually difference is in comment-line-break-function, which auto-fill-mode uses to insert line break. In js-mode, it’s set to c-indent-new-comment-line, which deletes the whitespace; in tree-sitter mode, it’s c-ts-common-comment-indent-new-line, which doesn’t. I fixed c-ts-common-comment-indent-new-line to do the same thing as c-indent-new-comment-line.
However, I did the foolish thing of pushing to master. Should I cherry pick the commit into emacs-30? Would that create any merge conflict down the line?
Yuan
next prev parent reply other threads:[~2024-10-29 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 3:46 bug#73900: 30.0.91; auto-fill adds extra space in js-ts-mode Michael Kleehammer
2024-10-27 10:55 ` Eli Zaretskii
2024-10-27 23:52 ` Yuan Fu
2024-10-28 3:10 ` Dmitry Gutov
2024-10-29 7:33 ` Yuan Fu [this message]
2024-10-29 12:39 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5F76FC01-BE2F-47CC-BA7A-4F77A2F4E41A@gmail.com \
--to=casouri@gmail.com \
--cc=73900@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=eliz@gnu.org \
--cc=michael@kleehammer.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.