qemu-devel
[Top][All Lists]
Advanced

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2] Add .dir-locals.el file to configure emacs coding style
Date: Thu, 18 Jun 2015 16:05:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On 18 June 2015 at 10:28, Markus Armbruster <address@hidden> wrote:
>> However, I can't see how I could define a new C style there without
>> pushing the "local variables" feature well beyond its intended use, and
>> triggering the confirmation prompts.
>
> We wouldn't want to define a new C style, but in general the items
> I have in my config over the Stroustrup defaults are going to be there
> because I've noticed something where Stroustrup doesn't indent right...

As far as I can see, the difference bwteen stroustrup style and yours is
a few tweaks to c-offsets-alist and c-hanging-braces-alist.  I'm not
sure how to do that from .dir-locals.el.

>> If we take Dan's patch, every Emacs user who hasn't already configured a
>> suitable style profits.  Users who have may have to adjust their
>> configuration to work with or around Dan's patch.
>
> Is there some way to tell whether your emacs has picked up the local
> style info rather than the one you have in your .emacs ?

The obvious way is to check the buffer-local variables.  Buffer-local
variable c-indentation-style is the name of the style in use.  Without
anything in .emacs or local variables, it's "gnu".  With your
(c-add-style "qemu" qemu-c-style) in .emacs, it should be "qemu".  With
Dan's .dir-locals.el, it should be "stroustrup".

When you can't or don't want to create or modify a .dir-locals.el, you
can do something like this instead:

    (dir-locals-set-class-variables 'qemu '((c-mode . ((c-file-style . 
"qemu")))))
    (dir-locals-set-directory-class "~/work/qemu" 'qemu)

This *overrides* .dir-locals.el in my testing.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]