Marc-André Lureau <marcandre.lur...@gmail.com> writes:

> Hi
>
> On Mon, Feb 12, 2018 at 10:52 AM, Daniel P. Berrangé
> <berra...@redhat.com> wrote:
>> On Sat, Feb 10, 2018 at 06:40:13PM -0600, Eric Blake wrote:
>>> Our QAPI input files aren't quite true JSON (comments being the obvious
>>> difference); naming things .json doesn't make that obvious.  Use a new
>>> suffix .qapi that makes it easy to identify our files.
>>>
>>> This change is mostly mechanical, but it is not just a global
>>> search-and-replace as some instances of '.json' really do refer
>>> to JSON files, or to a URL that can't change, and so on.
>>>
>>> Signed-off-by: Eric Blake <ebl...@redhat.com>
>>> ---
>>>
>>> I'd also like help figuring out how to make .dir-locals.el give
>>> an automatic sane mode to all .qapi files
>>
>> Stuff I'm reading the suggests the only way to achieve that is to
>> use 'eval' which is considered unsafe for .dir-locals.el. As a
>> result the user will get prompted to allow the "eval" to run
>> when emacs starts which is unpleasant :-(
>>
>
> I suggested such patch some time ago:
>
> "[PATCH 2/2] .dir-locals.el: add json schema to auto-mode"
>
> I still consider that a one time prompt for this is fairly unintrusive
> (after all you, run so much code you trust blindly by doing make check
> from qemu :)

Quoting myself (Message-ID: <878thydawr....@dusky.pond.sub.org>):

    Not a nice user experience.  [...]

    Why can't we simply use the usual file name extension like a normal
    person?

    If that's too much to ask, then I'd recommend adding modelines (like the
    ones you delete) to the Makefiles that lack one.

>> Alternatively though, just add "-*- json -*-" in a comment in
>> the first line of the file
>
>
> In each file, that's intrusive.

Interrupting every developer looking at source file with Emacs the first
time with a question that has security implications is also intrusive.
I've made my preference clear.

We already have modelines in 20 out of 190 .json files.  The missing one
are all under tests/.

>                                 Especially because there are no
> comments in json in theory :)

That's one of the reasons we use "-*- Mode: Python -*-" instead.

Reply via email to