emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should yaml-ts-mode inherit from prog-mode?


From: Rudolf Schlatte
Subject: Re: Should yaml-ts-mode inherit from prog-mode?
Date: Mon, 20 Mar 2023 15:37:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Mon, 20 Mar 2023 01:52:47 +0000
>> From: Randy Taylor <dev@rjt.dev>
>> Cc: rms@gnu.org, Romanos Skiadas <rom.skiad@gmail.com>, philipk@posteo.net, 
>> emacs-devel@gnu.org
>> 
>> Eli, do you have any comments?
>
> Nothing substantial, no.
>
>> The general consensus seems to be that yaml-ts-mode should inherit from 
>> prog-mode instead of
>> text-mode.
>> The arguments in favour make sense to me.
>
> That's not my impression.  My impression is that there are arguments
> both ways, and therefore the original decision of having it in
> textmodes still stands.  The arguments to the contrary were not strong
> enough to justify the move, IMO.

Let me try one last argument for making the switch to prog-mode.  Put
the following yaml fragment into a file and hit M-q ("fill-paragraph").
This destroys the yaml structure:

Before fill-paragraph:

    jobs:
      check:
        runs-on: ubuntu-latest
        strategy:
          fail-fast: false
          matrix:
            emacs_version:
              - 27.1
              - 27.2
              - 28.1
              - 28.2

After fill-paragraph:

    jobs: check: runs-on: ubuntu-latest strategy: fail-fast: false matrix:
      emacs_version: - 27.1 - 27.2 - 28.1 - 28.2

I'd argue that many commands offered by text-mode would have to be
audited or adapted to be meaningful in a yaml file; for example, what is
`forward-sentence' supposed to do in the context of yaml?

Most yaml files "in the wild" are configuration files (for Kubernetes,
ansible, and other "modern" tools), so in practice yaml-mode is much
closer to json-mode and lisp-data-mode, both of which derive from
prog-mode.

>From memory, my (probably unfair) impression of the arguments against
the change were "I checked the spec, and it isn't a programming language
and has no keywords, so it's clearly text", with the arguments for the
change were more like "these are the things I'd have to adjust to make
it more like prog-mode"; in my case, this would be changing to a
fixed-width font, turning off flyspell, and unbinding (for safety) lots
of text-mode keybindings as I run afoul of them.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]