From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ankit Gadiya via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#69562: 29.2.50; go-ts-mode does not handle comments with fill-paragraph Date: Wed, 6 Mar 2024 10:52:49 +0530 Message-ID: References: <7676dd25-a1f2-440f-abd2-90b2ba69b20d@gutov.dev> <9078f92b-f567-42ce-8539-30eb7d097828@gutov.dev> Reply-To: Ankit Gadiya Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23981"; mail-complaints-to="usenet@ciao.gmane.io" To: Dmitry Gutov , 69562@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 06 14:04:55 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rhqx5-0005wj-0H for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Mar 2024 14:04:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhqwn-00027C-Od; Wed, 06 Mar 2024 08:04:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhqwj-00022j-2G for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 08:04:33 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhqwi-0000wZ-Pe for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 08:04:32 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rhqxC-0005kv-Ha for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 08:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ankit Gadiya Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2024 13:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69562 X-GNU-PR-Package: emacs Original-Received: via spool by 69562-submit@debbugs.gnu.org id=B69562.170973028222066 (code B ref 69562); Wed, 06 Mar 2024 13:05:02 +0000 Original-Received: (at 69562) by debbugs.gnu.org; 6 Mar 2024 13:04:41 +0000 Original-Received: from localhost ([127.0.0.1]:50028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhqwr-0005jp-0k for submit@debbugs.gnu.org; Wed, 06 Mar 2024 08:04:41 -0500 Original-Received: from mail-vs1-f41.google.com ([209.85.217.41]:52318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhjlc-0004tv-HT for 69562@debbugs.gnu.org; Wed, 06 Mar 2024 00:24:40 -0500 Original-Received: by mail-vs1-f41.google.com with SMTP id ada2fe7eead31-472630e4152so1263235137.0 for <69562@debbugs.gnu.org>; Tue, 05 Mar 2024 21:24:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=argp.in; s=google; t=1709702580; x=1710307380; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=YItYPkzc60/B6nRT+nN1GPnCBIy5phNq7Q6Aadx1YSE=; b=J5A1kI2FtGHeFyShzXfLg2uZC/Zu8odzo44WTpQaIxfo5IsDRghTUoBpAfPI+ky5Wp Ze2ik1SvLwJAJOFRZaTWUsCUcs4iPCM6zQbcsZR+hHUh3lwoKCSie9oKPQ+XxTEGxJJI fGMjCqWpPGABkVRyYFXrlEmraBwatlshlF9A0OB7+abRL1hF5KMRZK29HdJG611Ywbz1 B+tq3YwARTaRGtHA2K26eAaCfQ1ZO3srSaK7Aa1ZTOAGYH/exCYnXFffuN8/NaCSnXxH ZVPEy2yzYTY00om8WxEkCb4GTcv55Ivlw6D+R8RhVAKpeg9+B3Ruwz6g96Ykl3yM14mE sPKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709702580; x=1710307380; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YItYPkzc60/B6nRT+nN1GPnCBIy5phNq7Q6Aadx1YSE=; b=QZqTJA35cPy1ijp28wgU9IEsqCJnPRIUICYReYbL8e/C2uZKb2Gj5axPzByCwtWuXk C/93b+cYRB8isWP/F87QbUzu4q7LxO/2aAlOQtVYzyDvnLeIFtENSRnx8RLK1lfLJKI8 T9mAib1yPuOXuK/SGP9kdm81m8CYfUcPhE0vwF/Lhc1YTkItoLLow4vVXEzL0RtMP7c2 8WaroKDWI7rHT0GHer47IVQ2rzZaXxotzucW3X9PGeU7N80PX5xIH6OrlFarYDhd9T/0 KbTMpZYGMeHxOK+E63mfPQq27++LlET1WHBsN4Ni7AWjzHigNaqtJ/JXkF1d4rI1Pmtw 4CxQ== X-Forwarded-Encrypted: i=1; AJvYcCXAYleZg55zsvWy/xWgm0oU9zad6NXUyAi+152ifhX/6nI0eIhmEUHTRS+lrZ/6NtGfPSffecO5d03cH77l3AvR5JsmY9g= X-Gm-Message-State: AOJu0YwXCu1RqSwAnivCLolAkuzyI06NO4dGLwFiYD7Eh8Ob9w4VLg69 yq7yNdG4U15JJsiP2mHHbZsgyURk9jEU8U4awCWpFhpALPv0vD8OwHTKpHtsQV7WXOzhLsoeIyl o9f4q/XEP/ya0HtNUCVTBVnbpqKKYZ2Tw4wneR1WORZ7fnecqBouWEg== X-Google-Smtp-Source: AGHT+IGAoLxtD8kEaV0iA2lxaMD/jonIziLTVS5FrIlpbBajCnXyB6CvvLA8kuVivF1W7HPjgzMMhfh5luE16mfnrQs= X-Received: by 2002:a05:6102:194f:b0:472:5c3e:caf4 with SMTP id jl15-20020a056102194f00b004725c3ecaf4mr3831055vsb.27.1709702580262; Tue, 05 Mar 2024 21:23:00 -0800 (PST) In-Reply-To: <9078f92b-f567-42ce-8539-30eb7d097828@gutov.dev> X-Mailman-Approved-At: Wed, 06 Mar 2024 08:04:39 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281112 Archived-At: On Tue, 5 Mar 2024 at 20:19, Dmitry Gutov wrote: > > Please keep the bug address in Cc. The bug tracker does not forward the > messages to others or save them in history otherwise. > Noted, thank you. > 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? > Yes, I only have one Emacs version installed on my system and I'm currently tracking the emacs-29 branch (last compiled maybe a week ago). I tried enabling `debug-on-entry` for the `fill-paragraph` function. Here is the Backtrace if it's useful. I think beyond this it goes into lower level buffer manipulation functions. current-left-margin() * move-to-left-margin() * forward-paragraph(1) * fill-forward-paragraph(1) * fill-region(17 269 nil) * #f(compiled-function (&optional justify region) "Fill paragraph at or after point.\n\nIf JUSTIFY is non-nil (interactively, with prefix argument), justify as well.\nIf `sentence-end-double-space' is non-nil, then period followed by one\nspace does not end a sentence, so don't break a line there.\nThe variable `fill-column' controls the width for filling.\n\nIf `fill-paragraph-function' is non-nil, we call it (passing our\nargument to it), and if it returns non-nil, we simply return its value.\n\nIf `fill-paragraph-function' is nil, return the `fill-prefix' used for filling.\n\nThe REGION argument is non-nil if called interactively; in that\ncase, if Transient Mark mode is enabled and the mark is active,\ncall `fill-region' to fill each of the paragraphs in the active\nregion, instead of just filling the current paragraph." (interactive #f(compiled-function () #)) #)(nil t) * apply(#f(compiled-function (&optional justify region) "Fill paragraph at or after point.\n\nIf JUSTIFY is non-nil (interactively, with prefix argument), justify as well.\nIf `sentence-end-double-space' is non-nil, then period followed by one\nspace does not end a sentence, so don't break a line there.\nThe variable `fill-column' controls the width for filling.\n\nIf `fill-paragraph-function' is non-nil, we call it (passing our\nargument to it), and if it returns non-nil, we simply return its value.\n\nIf `fill-paragraph-function' is nil, return the `fill-prefix' used for filling.\n\nThe REGION argument is non-nil if called interactively; in that\ncase, if Transient Mark mode is enabled and the mark is active,\ncall `fill-region' to fill each of the paragraphs in the active\nregion, instead of just filling the current paragraph." (interactive #f(compiled-function () #)) #) (nil t)) * fill-paragraph(nil t) funcall-interactively(fill-paragraph nil t) call-interactively(fill-paragraph record nil) command-execute(fill-paragraph record) execute-extended-command(nil "fill-paragraph" "fill-pa") funcall-interactively(execute-extended-command nil "fill-paragraph" "fill-pa") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command) > > Today @stebalien@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. I also tried pulling the latest grammar for go and it's still reproducing on my machine.