Skip to contentSkip to conversation

schemas: add missing vim modeline

PATCH Applied Victor Toso 3 participants 7 messages Dec 20, 2021 – Jan 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 schemas: add missing vim modeline

Similar to f7160f3218 "schemas: Add vim modeline"

---
 qapi/audio.json  | 1 +
 qapi/compat.json | 1 +
 qapi/replay.json | 1 +
 qapi/trace.json  | 1 +
 4 files changed, 4 insertions(+)
qapi/audio.json +1 -0
index 9cba0df8a4..fe3b506ec3 100644
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python
 #
 # Copyright (C) 2015-2019 Zoltán Kővágó <[email protected]>
 #
qapi/compat.json +1 -0
index dd7261ae2a..c53b69fe3f 100644
@@ -1,4 +1,5 @@
 # -*- Mode: Python -*-
+# vim: filetype=python
 
 ##
 # = Compatibility policy
qapi/replay.json +1 -0
index bfd83d7591..b4d1ba253b 100644
@@ -1,4 +1,5 @@
 # -*- Mode: Python -*-
+# vim: filetype=python
 #
 
 ##
qapi/trace.json +1 -0
index eedfded512..119509f565 100644
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python
 #
 # Copyright (C) 2011-2016 Lluís Vilanova <[email protected]>
 #
Signature · 1 line
2.33.1
#3 lore raw
In reply to Victor Toso
Quoted 15 lines · Victor Toso

Similar to f7160f3218 "schemas: Add vim modeline"

---
 qapi/audio.json  | 1 +
 qapi/compat.json | 1 +
 qapi/replay.json | 1 +
 qapi/trace.json  | 1 +
 4 files changed, 4 insertions(+)
qapi/audio.json +0 -0
index 9cba0df8a4..fe3b506ec3 100644

qapi/audio.json line 2

Quoted 2 lines
qapi/audio.json +1 -0
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python

I realise we have Emacs mode annotations here as well and I'm not going to start a holy war but I thought we used .editorconfig to avoid messing directly with the individual files. So something like:

[*.json]
indent_style = space
emacs_mode = python
vim_filetype = python

should also do the job.

Quoted 33 lines
qapi/audio.json +0 -0
 #
 # Copyright (C) 2015-2019 Zoltán Kővágó <[email protected]>
 #
qapi/compat.json +1 -0
index dd7261ae2a..c53b69fe3f 100644
@@ -1,4 +1,5 @@
 # -*- Mode: Python -*-
+# vim: filetype=python
 
 ##
 # = Compatibility policy
qapi/replay.json +1 -0
index bfd83d7591..b4d1ba253b 100644
@@ -1,4 +1,5 @@
 # -*- Mode: Python -*-
+# vim: filetype=python
 #
 
 ##
qapi/trace.json +1 -0
index eedfded512..119509f565 100644
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python
 #
 # Copyright (C) 2011-2016 Lluís Vilanova <[email protected]>
 #
Signature · 1 line
Alex Bennée
#4 lore raw
Quoted 24 lines · Alex Bennée
Quoted 15 lines · Victor Toso

Similar to f7160f3218 "schemas: Add vim modeline"

---
 qapi/audio.json  | 1 +
 qapi/compat.json | 1 +
 qapi/replay.json | 1 +
 qapi/trace.json  | 1 +
 4 files changed, 4 insertions(+)
qapi/audio.json +0 -0
index 9cba0df8a4..fe3b506ec3 100644

qapi/audio.json line 2

Quoted 2 lines
qapi/audio.json +1 -0
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python

I realise we have Emacs mode annotations here as well and I'm not going to start a holy war but I thought we used .editorconfig to avoid messing directly with the individual files. So something like:

Quoted 6 lines

[*.json]
indent_style = space
emacs_mode = python
vim_filetype = python

should also do the job.

Most schema files have lines for both Emacs and vim. Some have only the former, and this patch adds the latter to them. Seems fair to me.

Perhaps we could get rid of them all instead. As far as I can tell, .editorconfig doesn't work for stock Emacs out of the box, though.

#5 lore raw
Quoted 31 lines · Markus Armbruster
Quoted 29 lines · Alex Bennée
Quoted 15 lines · Victor Toso

Similar to f7160f3218 "schemas: Add vim modeline"

---
 qapi/audio.json  | 1 +
 qapi/compat.json | 1 +
 qapi/replay.json | 1 +
 qapi/trace.json  | 1 +
 4 files changed, 4 insertions(+)
qapi/audio.json +0 -0
index 9cba0df8a4..fe3b506ec3 100644

qapi/audio.json line 2

Quoted 2 lines
qapi/audio.json +1 -0
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python

I realise we have Emacs mode annotations here as well and I'm not going to start a holy war but I thought we used .editorconfig to avoid messing directly with the individual files. So something like:

[*.json]
indent_style = space
emacs_mode = python
vim_filetype = python

Quoted 7 lines
Quoted 1 line

should also do the job.

Most schema files have lines for both Emacs and vim. Some have only the former, and this patch adds the latter to them. Seems fair to me.

Perhaps we could get rid of them all instead. As far as I can tell, .editorconfig doesn't work for stock Emacs out of the box, though.

I think the same is true for vim. You need to enable a plugin for it. Similar to other IDEs.

If we have a formal way to suggest that developers install editorconfig plugin for their IDE it would be better than maintaining such annotations.

Cheers,
Victor

#6 lore raw
In reply to Markus Armbruster
Quoted 31 lines · Markus Armbruster
Quoted 29 lines · Alex Bennée
Quoted 15 lines · Victor Toso

Similar to f7160f3218 "schemas: Add vim modeline"

---
 qapi/audio.json  | 1 +
 qapi/compat.json | 1 +
 qapi/replay.json | 1 +
 qapi/trace.json  | 1 +
 4 files changed, 4 insertions(+)
qapi/audio.json +0 -0
index 9cba0df8a4..fe3b506ec3 100644

qapi/audio.json line 2

Quoted 2 lines
qapi/audio.json +1 -0
@@ -1,4 +1,5 @@
 # -*- mode: python -*-
+# vim: filetype=python

I realise we have Emacs mode annotations here as well and I'm not going to start a holy war but I thought we used .editorconfig to avoid messing directly with the individual files. So something like:

[*.json]
indent_style = space
emacs_mode = python
vim_filetype = python

Quoted 4 lines
Quoted 1 line

should also do the job.

Most schema files have lines for both Emacs and vim. Some have only the former, and this patch adds the latter to them. Seems fair to me.

No argument from me there.

Quoted 2 lines

Perhaps we could get rid of them all instead. As far as I can tell, .editorconfig doesn't work for stock Emacs out of the box, though.

It does require a package-install although fortunately it's in non-gnu elpa so should work out of the box with any reasonably recent Emacs. I personally wrap this stuff up in use-package:

;; EditorConfig
(use-package editorconfig
:ensure t
:diminish "EdCf"
:config
;; See https://github.com/editorconfig/editorconfig-emacs/issues/246
(add-to-list 'editorconfig-exclude-modes 'git-rebase-mode) (editorconfig-mode 1))

We also have have a rather embryonic .dir-locals in the root of the source tree as well.

Our vim-brethren seem to have multiple ways of installing their plugin:

https://github.com/editorconfig/editorconfig-vim#installation

Signature · 1 line
Alex Bennée