qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] editorconfig: set emacs mode


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH] editorconfig: set emacs mode
Date: Mon, 20 Aug 2018 19:43:10 +0200

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 <address@hidden>
---
 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




reply via email to

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