GNU bug report logs - #69562
29.2.50; go-ts-mode does not handle comments with fill-paragraph

Previous Next

Package: emacs;

Reported by: Ankit Gadiya <ankit <at> argp.in>

Date: Tue, 5 Mar 2024 12:24:01 UTC

Severity: normal

Found in version 29.2.50

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ankit Gadiya <ankit <at> argp.in>
Cc: 69562 <at> debbugs.gnu.org
Subject: bug#69562: 29.2.50; go-ts-mode does not handle comments with fill-paragraph
Date: Tue, 5 Mar 2024 16:49:44 +0200
Please keep the bug address in Cc. The bug tracker does not forward the 
messages to others or save them in history otherwise.

On 05/03/2024 16:22, Ankit Gadiya wrote:
>> Does you example originally have one long commented line? Because when I
>> try it that way, filling seems to work fine, comments are added on the
>> new lines.
> 
> Yes, I think the lines got wrapped in the mail but I had a long line. Admittedly
> that sample is specifically to showcase the issue but a more realistic scenario
> is when I already have multiline comments, I update it and want to re-fill
> it. Here also, it is clear that fill-paragraph does not respect the comment
> delimiter so it moves them just like regular characters.
> 
> (all comment lines start with // in case mail adds line breaks)
> 
>      // Sample is a sample function with a very long comment. Sample is a
>      // new details added to the comment sample function with a very
> long comment. Sample is a sample function
>      // with a very long comment. Sample is a sample function with a very long
>      // comment.
>      func Sample() {
> 
>      }
> 
> Becomes this
> 
>      // Sample is a sample function with a very long comment. Sample is a // new
>      details added to the comment sample function with a very long
> comment. Sample is
>      a sample function // with a very long comment. Sample is a sample
> function with
>      a very long // comment.
>      func Sample() {
> 
>      }

That's odd: here it becomes

  // Sample is a sample function with a very long comment. Sample is a
  // new details added to the comment sample function with a very long
  // comment. Sample is a sample function with a very long
  // comment. Sample is a sample function with a very long comment.
  func Sample() {
  	
  }

> I was able to reproduce it by running `emacs -Q` and manually enabling
> go-ts-mode in the go file. Please note that in the `go-mode` ELPA package it
> used to work as it defines its own fill-paragraph function. So possibly that
> function might be triggered for you if you have that configured?

I've also tried with 'emacs -Q', both the emacs-29 branch and master.

The version you included in the bug report (ae80192d97b8d0e54a94290) is 
very recent, so there can't be any commits that changed things since.

Are you testing in the same Emacs as the one you filed the bug report in?

> Today @stebalien <at> emacs.ch suggested to set adaptive-fill-regexp for go-ts-mode
> and that solved it for me (if this is useful).
> 
>      (setq-mode-local go-ts-mode adaptive-fill-regexp "[ \t]*//+[ \t]*")

TBH I'm not yet sure what the value of this variable should look like. 
But if I manage to reproduce the bug on my machine, this will be the 
next thing we can try, thanks.




This bug report was last modified 1 year and 74 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.