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: Vasilij Schneidermann
Subject: Re: Should yaml-ts-mode inherit from prog-mode?
Date: Wed, 1 Mar 2023 17:35:58 +0100

yaml-mode maintainer here. I saw the thread just by chance and found it
amusing that my decision was characterized as arbitrary, when the same
could be said about json-mode being indirectly derived from prog-mode
due to it looking a lot like JavaScript, not due to some deeper decision
making.

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

Yes, that was pretty much my reasoning. To quote the `prog-mode`
docstring: "Major mode for editing programming language source code."

Unless there's some XSLT equivalent for YAML, I do not see it being
programming language source code at all.

> 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.

Yes, I think it's a convenience argument really. I believe that
correctness/consistency are more important because such a decision is
long-lasting.

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

- If the mode is already established, changing what it derives from
  would make customizations relying on that fail
- If there are any hooks associated with prog-mode that are
  inappropriate for editing YAML, that would be an annoying consequence

More generally speaking, maybe the whole idea of having a hierarchy of
major modes needs to be rethought. It is difficult to get such a
hierarchy right, especially when there are multiple ways to categorize a
major mode. YAML has been argued to be several things (configuration,
serialization, text) and having to choose one in particular cannot work
out in a satisfying way unless it's about a very basic property not
based on opinion (I believe it to *not* be a configuration format at
all, but many people disagree and keep using it despite obvious
deficiencies) or personal preference (YAML is often touted as JSON
superset, but who actually uses that property, some malicious hackers
aside?). Perhaps a keyword system as used by finder.el would make more
sense, plus keyword-specific hooks to be run.

Attachment: signature.asc
Description: PGP signature


reply via email to

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