unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Brent Westbrook <bwestbr2@go.olemiss.edu>
To: emacs-devel@gnu.org
Subject: rust-ts-mode can't refill or reindent comments
Date: Thu, 29 Dec 2022 20:20:29 -0500	[thread overview]
Message-ID: <87sfgxvdjw.fsf@go.olemiss.edu> (raw)

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.

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.

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.



             reply	other threads:[~2022-12-30  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  1:20 Brent Westbrook [this message]
2022-12-30  8:37 ` rust-ts-mode can't refill or reindent comments Yuan Fu

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=87sfgxvdjw.fsf@go.olemiss.edu \
    --to=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).