From: Yuan Fu <casouri@gmail.com>
To: Brent Westbrook <bwestbr2@go.olemiss.edu>
Cc: emacs-devel@gnu.org
Subject: Re: rust-ts-mode can't refill or reindent comments
Date: Fri, 30 Dec 2022 00:37:48 -0800 [thread overview]
Message-ID: <09E67D79-E5DF-4A37-AB4C-62EF41FBB990@gmail.com> (raw)
In-Reply-To: <87sfgxvdjw.fsf@go.olemiss.edu>
> On Dec 29, 2022, at 5:20 PM, Brent Westbrook <bwestbr2@go.olemiss.edu> wrote:
>
> I've been trying out rust-ts-mode, and this is the second issue I've run
> into with prog-fill-reindent-defun. At first I could solve it by adding
> advice to the function to defer to fill-paragraph:
>
> (advice-add 'prog-fill-reindent-defun
> :around #'(lambda (_ _) (fill-paragraph)))
>
> but after rebuilding from the master branch today, fill-paragraph isn't
> working either. There are no errors or messages, but both
> prog-fill-reindent-defun and fill-paragraph fail to do anything on a
> very long comment line when I try calling them interactively or from
> bindings. I've also reproduced this with emacs -Q.
Strangely enough, it works in my config despite having a bug, so I didn’t notice it. Anyway, I fixed it.
>
> I think this is technically a bug, so I can file a bug report if
> preferred, but I thought it would be okay to discuss it here.
I forgot who said it, but the idea is “if you’re not sure if it warrants a bug, file a bug report”.
> As far as I can tell, rust-ts-mode is using c-ts-mode-comment-setup to
> prepare to format comments, but prog-fill-reindent-defun seems to work
> as expected on the Rust comment if I switch to c-ts-mode.
>
> For a concrete example, this is the comment from a bevy example that I'm
> testing on, with my fill-column set to 80:
>
> impl WallBundle {
> // This "builder method" allows us to reuse logic across our wall entities, making our code easier to read and less prone to bugs when we change the logic
> fn new(location: WallLocation) -> WallBundle {
>
> 28f26b11a1e seems to be the origin of the issue because
> prog-fill-reindent-defun works fine before that (again with -Q). I tried
> commenting out all of the adaptive-regexp stuff in
> c-ts-mode-comment-setup, closing the defun after line 656, and this
> fixed my issue in rust-ts-mode, but I assume the rest of that code is
> necessary for something and that the real issue is somewhere within it.
>
> I can keep bisecting that section of the code if that would help, but I
> thought someone more familiar with it might be able to identify the
> issue from here. I'm guessing that it's also some kind of clash with
> rust-ts-mode itself since that code works fine in c-ts-mode.
Thanks for debugging this, it should work now!
Yuan
prev parent reply other threads:[~2022-12-30 8:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 1:20 rust-ts-mode can't refill or reindent comments Brent Westbrook
2022-12-30 8:37 ` Yuan Fu [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09E67D79-E5DF-4A37-AB4C-62EF41FBB990@gmail.com \
--to=casouri@gmail.com \
--cc=bwestbr2@go.olemiss.edu \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).