[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] Add .dir-locals.el file to configure emacs c
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [PATCH v2] Add .dir-locals.el file to configure emacs coding style |
Date: |
Thu, 4 Jun 2015 15:15:56 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Jun 04, 2015 at 02:41:42PM +0100, Peter Maydell wrote:
> On 4 June 2015 at 14:30, Daniel P. Berrange <address@hidden> wrote:
> > Some default emacs setups indent by 2 spaces and uses tabs
> > which is counter to the QEMU coding style rules. Adding a
> > .dir-locals.el file in the top level of the GIT repo will
> > inform emacs about the QEMU coding style, and so assist
> > contributors in avoiding common style mistakes before
> > they submit patches.
> >
> > Signed-off-by: Daniel P. Berrange <address@hidden>
> > ---
> > .dir-locals.el | 2 ++
> > 1 file changed, 2 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))))
>
> My .emacs defines a style like this:
>
> (defconst qemu-c-style
> '((indent-tabs-mode . nil)
> (c-basic-offset . 4)
> (tab-width . 8)
> (c-comment-only-line-offset . 0)
> (c-offsets-alist . ((statement-block-intro . +)
> (substatement-open . 0)
> (label . 0)
> (statement-cont . +)
> (innamespace . 0)
> (inline-open . 0)
> ))
> (c-hanging-braces-alist .
> ((brace-list-open)
> (brace-list-intro)
> (brace-list-entry)
> (brace-list-close)
> (brace-entry-open)
> (block-close . c-snug-do-while)
> ;; structs have hanging braces on open
> (class-open . (after))
> ;; ditto if statements
> (substatement-open . (after))
> ;; and no auto newline at the end
> (class-close)
> ))
> )
> "QEMU C Programming Style")
>
> which is a superset of Stroustrup and gets a few more
> corner cases right, I think.
I'm not fussed about what we use as long as we have something, so I'm
happy to do a v3 using your suggested style instead :)
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|