* [Qemu-devel] [PATCH] editorconfig: set emacs mode
@ 2018-08-20 17:43 Marc-André Lureau
2018-08-20 18:00 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2018-08-20 17:43 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel, armbru, Marc-André Lureau
Some time ago, I proposed to use an (eval) in .dir-locals.el to set
the mode for all json files and Makefile. Unfortunately, this isn't
safe, and emacs will prompt the user, which isn't very friendly.
Fortunately, editorconfig provides a special config key which does
allow to set the emacs mode. Set the emacs mode for JSON, GLSL and
extra makefiles that are not yet covered. Drop modeline from JSON
files.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
qapi/block-core.json | 2 --
qapi/block.json | 2 --
qapi/char.json | 3 ---
qapi/common.json | 2 --
qapi/crypto.json | 3 ---
qapi/introspect.json | 2 --
qapi/job.json | 2 --
qapi/migration.json | 3 ---
qapi/misc.json | 3 ---
qapi/net.json | 3 ---
qapi/qapi-schema.json | 1 -
qapi/rocker.json | 2 --
qapi/run-state.json | 3 ---
qapi/sockets.json | 2 --
qapi/tpm.json | 3 ---
qapi/transaction.json | 3 ---
qapi/ui.json | 3 ---
.editorconfig | 13 +++++++++++++
Makefile.target | 2 --
docs/interop/firmware.json | 2 --
qga/qapi-schema.json | 2 --
tests/qapi-schema/doc-good.json | 1 -
tests/qapi-schema/qapi-schema-test.json | 2 --
23 files changed, 13 insertions(+), 51 deletions(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 4c7a37afdc..b1fb7ddf40 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# == Block core (VM unrelated)
##
diff --git a/qapi/block.json b/qapi/block.json
index 11f01f28ef..953e7de564 100644
--- a/qapi/block.json
+++ b/qapi/block.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# = Block devices
##
diff --git a/qapi/char.json b/qapi/char.json
index b7b2a05766..955d52aa01 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Character devices
##
diff --git a/qapi/common.json b/qapi/common.json
index c367adc4b6..236e5b3a0d 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# = Common data types
##
diff --git a/qapi/crypto.json b/qapi/crypto.json
index a51b434412..9720f145ff 100644
--- a/qapi/crypto.json
+++ b/qapi/crypto.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Cryptography
##
diff --git a/qapi/introspect.json b/qapi/introspect.json
index 137b39b992..e602a916f1 100644
--- a/qapi/introspect.json
+++ b/qapi/introspect.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-#
# Copyright (C) 2015 Red Hat, Inc.
#
# Authors:
diff --git a/qapi/job.json b/qapi/job.json
index a121b615fb..5e60f04bae 100644
--- a/qapi/job.json
+++ b/qapi/job.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# == Background jobs
##
diff --git a/qapi/migration.json b/qapi/migration.json
index 186e8a7303..3f96dfd5f5 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Migration
##
diff --git a/qapi/misc.json b/qapi/misc.json
index d450cfef21..a985d64739 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Miscellanea
##
diff --git a/qapi/net.json b/qapi/net.json
index c86f351161..74ab3fe34e 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Net devices
##
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 65b6dc2f6f..980c998173 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -1,4 +1,3 @@
-# -*- Mode: Python -*-
##
# = Introduction
#
diff --git a/qapi/rocker.json b/qapi/rocker.json
index 3587661161..0026c7fd59 100644
--- a/qapi/rocker.json
+++ b/qapi/rocker.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# = Rocker switch device
##
diff --git a/qapi/run-state.json b/qapi/run-state.json
index 332e44897b..14c88da0a9 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = VM run state
##
diff --git a/qapi/sockets.json b/qapi/sockets.json
index fc81d8d5e8..e83667c5c5 100644
--- a/qapi/sockets.json
+++ b/qapi/sockets.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-
##
# = Socket data types
##
diff --git a/qapi/tpm.json b/qapi/tpm.json
index d50deef5e9..2a33556b22 100644
--- a/qapi/tpm.json
+++ b/qapi/tpm.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = TPM (trusted platform module) devices
##
diff --git a/qapi/transaction.json b/qapi/transaction.json
index d7e4274550..ec74f88288 100644
--- a/qapi/transaction.json
+++ b/qapi/transaction.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Transactions
##
diff --git a/qapi/ui.json b/qapi/ui.json
index 4ca91bb45a..03d0a19da3 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1,6 +1,3 @@
-# -*- Mode: Python -*-
-#
-
##
# = Remote desktop
##
diff --git a/.editorconfig b/.editorconfig
index b2022e391a..683c543be3 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,10 +6,23 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
+[*.mak]
+indent_style = tab
+indent_size = 8
+file_type_emacs = makefile
+
[Makefile*]
indent_style = tab
indent_size = 8
+file_type_emacs = makefile
[*.{c,h}]
indent_style = space
indent_size = 4
+
+[*.{vert,frag}]
+file_type_emacs = glsl
+
+[*.json]
+indent_style = space
+file_type_emacs = python
diff --git a/Makefile.target b/Makefile.target
index 4d56298bbf..75bae962cd 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -1,5 +1,3 @@
-# -*- Mode: makefile -*-
-
BUILD_DIR?=$(CURDIR)/..
include ../config-host.mak
diff --git a/docs/interop/firmware.json b/docs/interop/firmware.json
index 28f9bc1591..a2b798118f 100644
--- a/docs/interop/firmware.json
+++ b/docs/interop/firmware.json
@@ -1,5 +1,3 @@
-# -*- Mode: Python -*-
-#
# Copyright (C) 2018 Red Hat, Inc.
#
# Authors:
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index dfbc4a5e32..447cea7701 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -1,5 +1,3 @@
-# *-*- Mode: Python -*-*
-
##
#
# General note concerning the use of guest agent interfaces:
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 984cd8ed06..2de41344ff 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -1,4 +1,3 @@
-# -*- Mode: Python -*-
# Positive QAPI doc comment tests
{ 'pragma': { 'doc-required': true } }
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index 11aa4c8f8d..765c30c9db 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -1,5 +1,3 @@
-# *-*- Mode: Python -*-*
-
# This file is a stress test of supported qapi constructs that must
# parse and compile correctly.
--
2.18.0.547.g1d89318c48
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] editorconfig: set emacs mode
2018-08-20 17:43 [Qemu-devel] [PATCH] editorconfig: set emacs mode Marc-André Lureau
@ 2018-08-20 18:00 ` Peter Maydell
2018-08-20 19:51 ` Eric Blake
0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2018-08-20 18:00 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: QEMU Developers, Gerd Hoffmann, Markus Armbruster
On 20 August 2018 at 18:43, Marc-André Lureau
<marcandre.lureau@redhat.com> wrote:
> Some time ago, I proposed to use an (eval) in .dir-locals.el to set
> the mode for all json files and Makefile. Unfortunately, this isn't
> safe, and emacs will prompt the user, which isn't very friendly.
>
> Fortunately, editorconfig provides a special config key which does
> allow to set the emacs mode. Set the emacs mode for JSON, GLSL and
> extra makefiles that are not yet covered. Drop modeline from JSON
> files.
Does emacs apply info from the the editorconfig file by default, though?
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] editorconfig: set emacs mode
2018-08-20 18:00 ` Peter Maydell
@ 2018-08-20 19:51 ` Eric Blake
2018-08-20 20:49 ` Marc-André Lureau
0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2018-08-20 19:51 UTC (permalink / raw)
To: Peter Maydell, Marc-André Lureau
Cc: Markus Armbruster, QEMU Developers, Gerd Hoffmann
On 08/20/2018 01:00 PM, Peter Maydell wrote:
> On 20 August 2018 at 18:43, Marc-André Lureau
> <marcandre.lureau@redhat.com> wrote:
>> Some time ago, I proposed to use an (eval) in .dir-locals.el to set
>> the mode for all json files and Makefile. Unfortunately, this isn't
>> safe, and emacs will prompt the user, which isn't very friendly.
>>
>> Fortunately, editorconfig provides a special config key which does
>> allow to set the emacs mode. Set the emacs mode for JSON, GLSL and
>> extra makefiles that are not yet covered. Drop modeline from JSON
>> files.
>
> Does emacs apply info from the the editorconfig file by default, though?
Per https://editorconfig.org/, no, you have to first install an emacs
plugin to get editorconfig files to have any effect. So this patch is a
non-starter unless distros start patching emacs to install that plugin
by default.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] editorconfig: set emacs mode
2018-08-20 19:51 ` Eric Blake
@ 2018-08-20 20:49 ` Marc-André Lureau
2018-08-21 5:26 ` Markus Armbruster
0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2018-08-20 20:49 UTC (permalink / raw)
To: Eric Blake; +Cc: Peter Maydell, Gerd Hoffmann, Markus Armbruster, QEMU
Hi
On Mon, Aug 20, 2018 at 9:55 PM Eric Blake <eblake@redhat.com> wrote:
>
> On 08/20/2018 01:00 PM, Peter Maydell wrote:
> > On 20 August 2018 at 18:43, Marc-André Lureau
> > <marcandre.lureau@redhat.com> wrote:
> >> Some time ago, I proposed to use an (eval) in .dir-locals.el to set
> >> the mode for all json files and Makefile. Unfortunately, this isn't
> >> safe, and emacs will prompt the user, which isn't very friendly.
> >>
> >> Fortunately, editorconfig provides a special config key which does
> >> allow to set the emacs mode. Set the emacs mode for JSON, GLSL and
> >> extra makefiles that are not yet covered. Drop modeline from JSON
> >> files.
> >
> > Does emacs apply info from the the editorconfig file by default, though?
>
> Per https://editorconfig.org/, no, you have to first install an emacs
> plugin to get editorconfig files to have any effect. So this patch is a
> non-starter unless distros start patching emacs to install that plugin
> by default.
But .editorconfing is already present in qemu source tree. (and fwiw,
it's installed by default with some starter kits, like prelude).
What's the issue adding the emacs mode in the config file?
Let's keep the modeline in existing files if you prefer, but it's
still very limited (a majority of files are not covered). And I would
rather see it gone, than having editor-specific lines in our source
files.
thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] editorconfig: set emacs mode
2018-08-20 20:49 ` Marc-André Lureau
@ 2018-08-21 5:26 ` Markus Armbruster
0 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2018-08-21 5:26 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: Eric Blake, QEMU, Peter Maydell, Gerd Hoffmann
Marc-André Lureau <marcandre.lureau@gmail.com> writes:
> Hi
>
> On Mon, Aug 20, 2018 at 9:55 PM Eric Blake <eblake@redhat.com> wrote:
>>
>> On 08/20/2018 01:00 PM, Peter Maydell wrote:
>> > On 20 August 2018 at 18:43, Marc-André Lureau
>> > <marcandre.lureau@redhat.com> wrote:
>> >> Some time ago, I proposed to use an (eval) in .dir-locals.el to set
>> >> the mode for all json files and Makefile. Unfortunately, this isn't
>> >> safe, and emacs will prompt the user, which isn't very friendly.
>> >>
>> >> Fortunately, editorconfig provides a special config key which does
>> >> allow to set the emacs mode. Set the emacs mode for JSON, GLSL and
>> >> extra makefiles that are not yet covered. Drop modeline from JSON
>> >> files.
>> >
>> > Does emacs apply info from the the editorconfig file by default, though?
>>
>> Per https://editorconfig.org/, no, you have to first install an emacs
>> plugin to get editorconfig files to have any effect. So this patch is a
>> non-starter unless distros start patching emacs to install that plugin
>> by default.
>
> But .editorconfing is already present in qemu source tree. (and fwiw,
> it's installed by default with some starter kits, like prelude).
>
> What's the issue adding the emacs mode in the config file?
>
> Let's keep the modeline in existing files if you prefer, but it's
> still very limited (a majority of files are not covered). And I would
> rather see it gone, than having editor-specific lines in our source
> files.
I'm fine with adding stuff to .editorconfig that helps users.
Replacing Emacs file local variables by .editorconfig hurts Emacs users
that don't have the plugin set up.
I suggest you respin with the deletions dropped, and the additions to
.editorconfig limited to ones that still make a difference.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-21 5:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-20 17:43 [Qemu-devel] [PATCH] editorconfig: set emacs mode Marc-André Lureau
2018-08-20 18:00 ` Peter Maydell
2018-08-20 19:51 ` Eric Blake
2018-08-20 20:49 ` Marc-André Lureau
2018-08-21 5:26 ` Markus Armbruster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).