[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] qapi: Rename .json to .qapi
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] qapi: Rename .json to .qapi |
Date: |
Fri, 20 Apr 2018 08:16:56 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/20/2018 04:27 AM, Dr. David Alan Gilbert wrote:
> * Markus Armbruster (address@hidden) wrote:
>> Eric Blake <address@hidden> writes:
>>
>>> Our QAPI input files aren't quite true JSON (comments being one obvious
>>> difference); naming things .json doesn't make that obvious. Use a new
>>> suffix .qapi that makes it easy to identify our files.
>>
>> I agree that .json is sub-optimal. Evidence: we add Emacs file
>> variables to get Python mode, because that's less wrong than JavaScript
>> mode. Except for "trivial" files, where we can't be bothered.
>>
>> The rename lessens the human confusion, but increases the Editor
>> confusion somewhat: we get Fundamental mode for "trivial" files, which
>> is more wrong than JavaScript mode.
>>
>> One way to avoid that would be adding file variables to all files.
>
> That depends on your editor; this rename makes life **much** better
> in vim; with them as .json files they display with white text on
> bright red background (I guess because it's upset by syntax somewhere)
> but as .qapi files it's readable (I'm not entirely sure which syntax
> it's using)
It's also possible to document that emacs users can add to their .emacs
file:
(add-to-list 'auto-mode-alist '("\\.qapi\\'" . python-mode))
to automatically treat all .qapi files with sane highlighting. Sadly,
.dir-locals.el cannot do this without warning the users about an unsafe
'eval' variable, so users that don't do their own manual setup are stuck
with fundamental mode on trivial files.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature