Received: from eggs.gnu.org ([2001:4830:134:3::10]:54579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z03Od-0004CX-PZ for qemu-devel@nongnu.org; Wed, 03 Jun 2015 03:47:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z03Oa-0001Wk-Jp for qemu-devel@nongnu.org; Wed, 03 Jun 2015 03:47:31 -0400 From: Markus Armbruster References: <1433258768-28946-1-git-send-email-berrange@redhat.com> Date: Wed, 03 Jun 2015 09:47:24 +0200 In-Reply-To: <1433258768-28946-1-git-send-email-berrange@redhat.com> (Daniel P. Berrange's message of "Tue, 2 Jun 2015 16:26:08 +0100") Message-ID: <87twupxmgj.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] Add .dir-locals.el file to configure emacs coding style List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org "Daniel P. Berrange" writes: > The default emacs setup indents 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. Yes, please! > Signed-off-by: Daniel P. Berrange > --- > .dir-locals.el | 8 ++++++++ > 1 file changed, 8 insertions(+) > create mode 100644 .dir-locals.el > > diff --git a/.dir-locals.el b/.dir-locals.el > new file mode 100644 > index 0000000..ddb2fae > --- /dev/null > +++ b/.dir-locals.el > @@ -0,0 +1,8 @@ > +( > + (c-mode . ( > + (c-file-style . "K&R") > + (indent-tabs-mode . nil) > + (c-indent-level . 4) > + (c-basic-offset . 4) > + )) > +) Unidiomatic placement of parenthesis. The documented style name is "k&r", not "K&R". This is its definition in my Emacs (23.4.1): ("k&r" (c-basic-offset . 5) (c-comment-only-line-offset . 0) (c-offsets-alist . ((statement-block-intro . +) (knr-argdecl-intro . 0) (substatement-open . 0) (substatement-label . 0) (label . 0) (statement-cont . +)))) You overwrite c-basic-offset. But then you can just as well use style "stroustrup": ("stroustrup" (c-basic-offset . 4) (c-comment-only-line-offset . 0) (c-offsets-alist . ((statement-block-intro . +) (substatement-open . 0) (substatement-label . 0) (label . 0) (statement-cont . +)))) What does c-indent-level do? Are you sure it's needed? Does the following .dir-locals.el work for you equally well? ((c-mode . ((c-file-style . "stroustrup") (indent-tabs-mode . nil))))