[Top][All Lists]

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

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

From: Randy Taylor
Subject: Re: Should yaml-ts-mode inherit from prog-mode?
Date: Wed, 01 Mar 2023 14:08:52 +0000

On Tuesday, February 28th, 2023 at 10:52, Basil Contovounesios 
<contovob@tcd.ie> wrote:
> Romanos Skiadas [2023-02-28 14:24 +0200] wrote:
> > I was using yaml-ts-mode in Emacs 30, and to my surprise I found it 
> > inherits from text-mode.
> >
> > Now, a case can be made for that for sure. The existing rather widely used 
> > mode uses text-mode, although that seems like an arbitrary
> > decision by a single maintainer:
> > https://github.com/yoshiki/yaml-mode/issues/17
> > https://github.com/yoshiki/yaml-mode/issues/27
> > https://github.com/yoshiki/yaml-mode/issues/52
> > https://github.com/yoshiki/yaml-mode/pull/85
> >
> > (I'm not sure Emacs maintainers are beholden to a decision made some jumps 
> > away and whether this is a strong enough argument to
> > keep yaml-ts-mode as is.)
> >
> > However, and here is where things kind of break down a bit: I would 
> > personally argue that YAML has a code feel to it, what with all the
> > bash scripts that end up in it. Personally, I feel that YAML is more of a 
> > prog language than JSON (whatever that means), and according to
> > the spec it is a superset of JSON. In fact, the JSON mode shipped with 
> > Emacs inherits from prog-mode!
> >
> > So, what do people think? Should yaml-ts-mode be changed?
> [ Copying in Randy, yaml-ts-mode's author/maintainer. ]


> FWIW, my vote is for treating YAML and JSON consistently: if all three
> JSON modes in Emacs and GNU ELPA are prog-modes, then so should
> yaml-ts-mode; or if yaml-ts-mode is a text-mode, then so should all
> three JSON modes.
> I suspect most of that ship if not the entire thing has already sailed,
> especially in the case of the more established json-mode, but there's
> always hope ;).
> Thanks,
> --
> Basil

I think the JSON modes are prog-modes just because they are attached to the 
javascript modes in some way (usually derived from it). I'm not sure how much 
weight we can assign to certain modes deriving from other modes and saying we 
should do the same (especially in the case of ELPA/MELPA modes); instead we 
should ask which mode makes the most sense to derive from. Although there is 
the argument for consistency that you mentioned...

Deriving from prog-mode feels weird since YAML is not a programming language.

A lot of people (per OP's linked GitHub issues) seem to think/expect it to 
derive from prog-mode, but I'm not sure how correct those assumptions are. It 
seems they just want their prog-mode hooks to work with it.

If everyone thinks it should derive from prog-mode and there are no bad 
consequences for doing so, then I'm not against it.

Do any Emacs maintainers have any thoughts on the matter?

reply via email to

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