editorconfig: set emacs mode
PATCH 1/1 editorconfig: set emacs mode
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.
--- 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(-)
qapi/block-core.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # == Block core (VM unrelated) ##
qapi/block.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # = Block devices ##
qapi/char.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Character devices ##
qapi/common.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # = Common data types ##
qapi/crypto.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Cryptography ##
qapi/introspect.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- -# # Copyright (C) 2015 Red Hat, Inc. # # Authors:
qapi/job.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # == Background jobs ##
qapi/migration.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Migration ##
qapi/misc.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Miscellanea ##
qapi/net.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Net devices ##
qapi/qapi-schema.json +0 -1
@@ -1,4 +1,3 @@ -# -*- Mode: Python -*- ## # = Introduction #
qapi/rocker.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # = Rocker switch device ##
qapi/run-state.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = VM run state ##
qapi/sockets.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- - ## # = Socket data types ##
qapi/tpm.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = TPM (trusted platform module) devices ##
qapi/transaction.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Transactions ##
qapi/ui.json +0 -3
@@ -1,6 +1,3 @@ -# -*- Mode: Python -*- -# - ## # = Remote desktop ##
.editorconfig +13 -0
@@ -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
Makefile.target +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: makefile -*- - BUILD_DIR?=$(CURDIR)/.. include ../config-host.mak
docs/interop/firmware.json +0 -2
@@ -1,5 +1,3 @@ -# -*- Mode: Python -*- -# # Copyright (C) 2018 Red Hat, Inc. # # Authors:
qga/qapi-schema.json +0 -2
@@ -1,5 +1,3 @@ -# *-*- Mode: Python -*-* - ## # # General note concerning the use of guest agent interfaces:
tests/qapi-schema/doc-good.json +0 -1
@@ -1,4 +1,3 @@ -# -*- Mode: Python -*- # Positive QAPI doc comment tests { 'pragma': { 'doc-required': true } }
tests/qapi-schema/qapi-schema-test.json +0 -2
@@ -1,5 +1,3 @@ -# *-*- Mode: Python -*-* - # This file is a stress test of supported qapi constructs that must # parse and compile correctly.
Signature · 1 line
2.18.0.547.g1d89318c48
Quoted 8 lines · 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.
Does emacs apply info from the the editorconfig file by default, though?
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 4 lines · 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.
Quoted 6 lines
Quoted 4 lines
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.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Hi
Quoted 13 lines · Eric Blake
Quoted 11 lines · Peter Maydell
Quoted 8 lines · 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.
Quoted 6 lines
Quoted 1 line
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
Quoted 26 lines · Marc-André Lureau
Hi
Quoted 13 lines · Eric Blake
Quoted 11 lines · Peter Maydell
Quoted 8 lines · 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.
Quoted 6 lines
Quoted 1 line
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).
Quoted 6 lines
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.