GNU bug report logs -
#35224
[PATCH] include indentation size in .dir-locals
Previous Next
Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Date: Thu, 11 Apr 2019 01:12:01 UTC
Severity: wishlist
Tags: patch, wontfix
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #19 received at 35224 <at> debbugs.gnu.org (full text, mbox):
On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios
<contovob <at> tcd.ie> wrote:
> severity 35224 wishlist
> quit
>
> Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:
>
>> On Чт, Apr 11, 2019 at 03:16, Basil L. Contovounesios
>> <contovob <at> tcd.ie> wrote:
>>> Konstantin Kharlamov <Hi-Angel <at> yandex.ru> writes:
>>>
>>>> * .dir-locals.el (c-mode): include indentation size
>>>> ---
>>>> .dir-locals.el | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/.dir-locals.el b/.dir-locals.el
>>>> index 9cd39920c23..657ac32d00f 100644
>>>> --- a/.dir-locals.el
>>>> +++ b/.dir-locals.el
>>>> @@ -3,6 +3,7 @@
>>>> (fill-column . 70)))
>>>> (c-mode . ((c-file-style . "GNU")
>>>> (c-noise-macro-names . ("INLINE"
>>>> "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK"
>>>> "ALIGN_STACK"))
>>>> + (c-basic-offset . 2)
>>>> (electric-quote-comment . nil)
>>>> (electric-quote-string . nil)))
>>>> (objc-mode . ((c-file-style . "GNU")
>>>
>>> The "GNU" c-file-style already sets c-basic-offset to 2.
>>> See c-style-alist and (info "(ccmode) Customizing Indentation").
>>
>> Oh, this is odd. For some reason I have 4 as the size. I have it
>> set through
>> c-basic-offset by default, but I can't reproduce it with emacs -Q
>> --eval, i.e.
>> opening C file resets it to 2 as should be.
>
> Globally setting c-basic-offset overrides the cc-mode style
> inheritance
> system. There are various ways to customise this variable in a more
> granular way, such as defining a custom style which inherits from a
> built-in style, or setting c-basic-offset locally in a mode hook.
> For details, see (info "(ccmode) Config Basics").
Oh, okay, so this works as expected. But since googling "change
indentation size" always gives using specifically c-basic-offset (e.g.
https://stackoverflow.com/questions/14939608/how-to-change-emacs-struct-indents-from-4-to-2-spaces),
I guess it's safe to assume most of Emacs users has it changed. So it's
useful to add this to dir-locals anyway.
This bug report was last modified 6 years and 26 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.