GNU bug report logs -
#68781
[PATCH] Don't fill yaml except comments and block scalars.
Previous Next
Reported by: Rudolf Schlatte <rudi <at> constantly.at>
Date: Sun, 28 Jan 2024 13:17:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Sunday, January 28th, 2024 at 08:15, Rudolf Schlatte <rudi <at> constantly.at> wrote:
>
>
> Tags: patch
>
> 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.
This bug report was last modified 1 year and 164 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.