From: Randy Taylor <dev@rjt.dev>
To: Rudolf Schlatte <rudi@constantly.at>
Cc: "graham@mgmarlow.com" <graham@mgmarlow.com>, 68781@debbugs.gnu.org
Subject: bug#68781: [PATCH] Don't fill yaml except comments and block scalars.
Date: Mon, 29 Jan 2024 03:47:53 +0000 [thread overview]
Message-ID: <wpwe_vPrFwaj6Qmy63wNHVWLI5eFTYsiZexkKtihbBxx5Qfdu4Dab-x4Rtenc_DxKGa98EZVEYwJk-VoscZIVdLVwZWKPAtPeS0gwGu0hvE=@rjt.dev> (raw)
In-Reply-To: <m18r49iooh.fsf@constantly.at>
On Sunday, January 28th, 2024 at 08:15, Rudolf Schlatte <rudi@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.
next prev parent reply other threads:[~2024-01-29 3:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 13:15 bug#68781: [PATCH] Don't fill yaml except comments and block scalars Rudolf Schlatte
2024-01-28 14:52 ` Rudolf Schlatte
2024-01-29 3:47 ` Randy Taylor [this message]
2024-01-29 8:20 ` Rudolf Schlatte
2024-01-29 14:08 ` Randy Taylor
2024-01-30 1:20 ` Graham Marlow
2024-01-30 10:15 ` Rudolf Schlatte
2024-01-30 19:25 ` Randy Taylor
2024-02-01 10:31 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='wpwe_vPrFwaj6Qmy63wNHVWLI5eFTYsiZexkKtihbBxx5Qfdu4Dab-x4Rtenc_DxKGa98EZVEYwJk-VoscZIVdLVwZWKPAtPeS0gwGu0hvE=@rjt.dev' \
--to=dev@rjt.dev \
--cc=68781@debbugs.gnu.org \
--cc=graham@mgmarlow.com \
--cc=rudi@constantly.at \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.