diff mbox series

[RISU,v5,02/13] README: document the coding style used for risu

Message ID 20170619104655.31104-3-alex.bennee@linaro.org
State Superseded
Headers show
Series RISU record/replay patches | expand

Commit Message

Alex Bennée June 19, 2017, 10:46 a.m. UTC
We also include the an Emacs .dir-locals (as per QEMU) that enforces
this layout.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 .dir-locals.el | 2 ++
 README         | 9 +++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 .dir-locals.el

-- 
2.13.0

Comments

Peter Maydell June 20, 2017, 12:54 p.m. UTC | #1
On 19 June 2017 at 11:46, Alex Bennée <alex.bennee@linaro.org> wrote:
> We also include the an Emacs .dir-locals (as per QEMU) that enforces

> this layout.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  .dir-locals.el | 2 ++

>  README         | 9 +++++++++

>  2 files changed, 11 insertions(+)

>  create mode 100644 .dir-locals.el

>

> diff --git a/.dir-locals.el b/.dir-locals.el

> new file mode 100644

> index 0000000..3ac0cfc

> --- /dev/null

> +++ b/.dir-locals.el

> @@ -0,0 +1,2 @@

> +((c-mode . ((c-file-style . "stroustrup")

> +           (indent-tabs-mode . nil))))


This prompted me to look at this, and this is wrong: it
overrides my local emacs config with something that gets
some bits of style wrong :-( Indeed there's one in QEMU
now I see, and that is why my emacs behaviour has regressed.
For instance given

static const VMStateDescription cmsdk_apb_uart_vmstate = {
    .name = "cmsdk-apb-uart",
    .version_id = 1,
    .minimum_version_id = 1,
    .fields = (VMStateField[]) {
        VMSTATE_END_OF_LIST()


with cursor on the blank line at the end, if I type '}' then I get
     }\n
(ie the cursor moves to a new line) but the cursor should
stay after the '}' so I can type the ','.

thanks
-- PMM
diff mbox series

Patch

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..3ac0cfc
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,2 @@ 
+((c-mode . ((c-file-style . "stroustrup")
+	    (indent-tabs-mode . nil))))
diff --git a/README b/README
index 4b37b4e..858a349 100644
--- a/README
+++ b/README
@@ -42,6 +42,15 @@  architecture that we support and that you have a cross compiler
 installed for. This is useful for confirming that your changes
 to risu haven't broken anything.
 
+Coding Style
+------------
+
+risu follows the same coding style as the QEMU project, namely 4
+spaces (no tabs) for indentation and the One True Brace Style variant
+of K&R. The source tree includes a .dir-locals.el for Emacs users that
+will set this automatically. Other editors are available.
+
+
 Usage
 -----