From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rudolf Schlatte Newsgroups: gmane.emacs.bugs Subject: bug#68781: [PATCH] Don't fill yaml except comments and block scalars. Date: Mon, 29 Jan 2024 09:20:04 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35599"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "graham@mgmarlow.com" , 68781@debbugs.gnu.org To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 29 09:21:16 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 1rUMtH-000949-OO for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jan 2024 09:21:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUMsy-0002UB-GI; Mon, 29 Jan 2024 03:20:56 -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 1rUMsw-0002Ti-US for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 03:20:55 -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 1rUMsw-0000ua-Lh for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 03:20:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rUMt4-0006Gf-EV for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 03:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Rudolf Schlatte Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jan 2024 08:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68781 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68781-submit@debbugs.gnu.org id=B68781.170651642524043 (code B ref 68781); Mon, 29 Jan 2024 08:21:02 +0000 Original-Received: (at 68781) by debbugs.gnu.org; 29 Jan 2024 08:20:25 +0000 Original-Received: from localhost ([127.0.0.1]:59017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUMsT-0006Fj-Dj for submit@debbugs.gnu.org; Mon, 29 Jan 2024 03:20:25 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUMsQ-0006FT-Rl for 68781@debbugs.gnu.org; Mon, 29 Jan 2024 03:20:24 -0500 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id D2E2F5C0121; Mon, 29 Jan 2024 03:20:08 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 29 Jan 2024 03:20:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706516408; x=1706602808; bh=oJRsUehJrQgQgJ5Vu4Vy23CNnvDr 2Hw4HK/QWEEUj3M=; b=NUqjEBHF6AdxG4Z0mug+SwUITpEo58j5nhtNNQ18NtqW 4OSotFXFxUxyNhUmk/i3QMOp0d5pukWtxUllWKoD0XWUNKMnOtimE5iOCYEBASFc g4pk22HO0zEUtzI8Ciba4OtbpOKO+xAL19A2pCkerDOlJGIoDiX3KwfqIHE2TQNK MITnhS8tQYxORgmof4av5x8YCJnOpynCkgQSew7ad6DzGzflEDyrt7JNeJNVyRkl /HTMgZKIexsMmZT6UoDqt/twHz6aG8vEZW27DKVVVUwJh1YfxNXgKggsHMz7wcH4 ZxAzPLGy8Fgrv0M4mgkH+GDw39uFrdUicaxTWc08nQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtfedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefujghffffkfgggtgesth dtredttdertdenucfhrhhomheptfhuugholhhfucfutghhlhgrthhtvgcuoehruhguihes tghonhhsthgrnhhtlhihrdgrtheqnecuggftrfgrthhtvghrnhepledvhfeftddtudehue dvveeguedvheejudeugfevhfejhffhgeeljeeuheeffefhnecuffhomhgrihhnpehgihht hhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehruhguihestghonhhsthgrnhhtlhihrdgrth X-ME-Proxy: Feedback-ID: i5b4840b3:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Jan 2024 03:20:07 -0500 (EST) In-Reply-To: (Randy Taylor's message of "Mon, 29 Jan 2024 03:47:53 +0000") 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:279121 Archived-At: Randy Taylor writes: > On Sunday, January 28th, 2024 at 08:15, Rudolf Schlatte wrote: >> >> Hi, >> >> Currently, yaml-ts-mode fills comments and block scalars (multi-line >> text literals) as expected, but re-fills the whole file when point is >> outside of either of these constructs. Since yaml line breaks and >> whitespace are significant, I'd say that this is never the correct >> behavior. >> >> This patch against current master inhibits M-q (fill-paragraph) outside >> of comments and block scalars. In my tests default fill-paragraph >> worked as expected both with and without justify, correctly detecting >> comment and block literal boundaries, so I did not preserve the previous >> code in `yaml-ts-mode--fill-paragraph'. > > Thanks for working on this. > > The previous implementation (see bug#68226) provided an example where: > foo: | > line-one > line-two > > Would become: > foo: | line-one line-two > > When it should be: > foo: | > line-one line-two > > Your patch undoes this fix. > > I think I also ran into another bug using your patch: when inside a block > scalar, for example, running fill-paragraph will re-fill the whole file (or > parts of it at least). > > I agree that we shouldn't try to fill anything that isn't a comment or block > scalar, and I also like the change in your other message where only the > paragraph that point is on gets filled. > > BTW would it be possible to add tests for these? See `c-ts-mode-tests.el', > specifically `c-ts-mode-test-filling', for inspiration. > > Graham, you added `yaml-ts-mode--fill-paragraph' - what are your thoughts? See also Rudolf's other message. Hello Randy, thanks for having a look! Could you tell me which tree-sitter grammar you are using? I'm asking because with the grammar from https://github.com/ikatyang/tree-sitter-yaml I don't see what you describe. Needless to say, please don't install the patch before I have debugged this. :) Best, Rudi