GNU bug report logs - #35224
[PATCH] include indentation size in .dir-locals

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35224 in the body.
You can then email your comments to 35224 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 01:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Konstantin Kharlamov <Hi-Angel <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 11 Apr 2019 01:12:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 04:10:46 +0300
* .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")
-- 
2.21.0





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 02:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 03:16:56 +0100
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").

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 06:25:02 GMT) Full text and rfc822 format available.

Message #11 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 09:24:38 +0300

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.

I'll research more on this later this evening then.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 10:28:02 GMT) Full text and rfc822 format available.

Message #14 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 11:26:42 +0100
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").

-- 
Basil




Severity set to 'wishlist' from 'normal' Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Thu, 11 Apr 2019 10:28:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 10:40:02 GMT) Full text and rfc822 format available.

Message #19 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 13:39:03 +0300

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.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 10:59:01 GMT) Full text and rfc822 format available.

Message #22 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 11:58:37 +0100
Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:

> On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios <contovob <at> tcd.ie> wrote:
>
>> 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.

IMO, that's a bug in the configuration of those users because they're
overriding how cc-mode works, and the cc-mode manual describes in detail
the various ways to customise indentation.  So I don't see a need to
change the Emacs dir-locals-file to accommodate this use-case.

But that's just one opinion, and I'm not familiar with prevailing policy
on what to add to the Emacs dir-locals-file.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 13:32:02 GMT) Full text and rfc822 format available.

Message #25 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35224 <at> debbugs.gnu.org, hi-angel <at> yandex.ru
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 16:30:43 +0300
> From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
> Date: Thu, 11 Apr 2019 11:58:37 +0100
> Cc: 35224 <at> debbugs.gnu.org
> 
> IMO, that's a bug in the configuration of those users because they're
> overriding how cc-mode works, and the cc-mode manual describes in detail
> the various ways to customise indentation.  So I don't see a need to
> change the Emacs dir-locals-file to accommodate this use-case.
> 
> But that's just one opinion, and I'm not familiar with prevailing policy
> on what to add to the Emacs dir-locals-file.

I don't think we have any definitive policy, but FWIW, I agree with
Basil on this one.

Does anyone else have an opinion?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 13:58:01 GMT) Full text and rfc822 format available.

Message #28 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <hi-angel <at> yandex.ru>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 16:56:44 +0300

On Чт, Apr 11, 2019 at 11:58, Basil L. Contovounesios 
<contovob <at> tcd.ie> wrote:
> Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:
> 
>>  On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios 
>> <contovob <at> tcd.ie> wrote:
>> 
>>>  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.
> 
> IMO, that's a bug in the configuration of those users because they're
> overriding how cc-mode works, and the cc-mode manual describes in 
> detail
> the various ways to customise indentation.  So I don't see a need to
> change the Emacs dir-locals-file to accommodate this use-case.

Okay, but we can't ignore the fact that such usecase exists and is 
widely employed (if needed, I can throw more links to these advices on 
stackexchange site).

So let me ask: is there a downside to making this change? Because if 
there's none then the change is an improvement, it's that simple.

> But that's just one opinion, and I'm not familiar with prevailing 
> policy
> on what to add to the Emacs dir-locals-file.
> 
> --
> Basil






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Thu, 11 Apr 2019 15:24:01 GMT) Full text and rfc822 format available.

Message #31 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Cc: 35224 <at> debbugs.gnu.org
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Thu, 11 Apr 2019 16:22:54 +0100
Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:

> On Чт, Apr 11, 2019 at 11:58, Basil L. Contovounesios <contovob <at> tcd.ie> wrote:
>> Konstantin Kharlamov <hi-angel <at> yandex.ru> writes:
>>
>>>  On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios <contovob <at> tcd.ie>
>>> wrote:
>>>
>>>>  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.
>>
>> IMO, that's a bug in the configuration of those users because they're
>> overriding how cc-mode works, and the cc-mode manual describes in detail
>> the various ways to customise indentation.  So I don't see a need to
>> change the Emacs dir-locals-file to accommodate this use-case.
>
> Okay, but we can't ignore the fact that such usecase exists and is widely
> employed (if needed, I can throw more links to these advices on stackexchange
> site).

The widespread dissemination of synoptic, not universally applicable, or
bad advise in the wild doesn't necessarily validate any particular
use-case.

> So let me ask: is there a downside to making this change? Because if there's
> none then the change is an improvement, it's that simple.

The downside is that this is an invasive change in that it affects all
people working on the Emacs sources.  For many it may have no obvious
effect, for others it may mask problems/inconsistencies in their
configuration, and yet others it may end up annoying due to unforeseen
consequences.  A net loss, potentially.

There is nothing obviously wrong with the current Emacs dir-locals-file
in this respect (if it ain't broke don't fix it), whereas the user
customisations you refer to are arguably problematic (if it is broke fix
it).

Again, just one opinion; I won't mind if others welcome this change.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35224; Package emacs. (Sun, 23 Jun 2019 17:44:02 GMT) Full text and rfc822 format available.

Message #34 received at 35224 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 35224 <at> debbugs.gnu.org,
 hi-angel <at> yandex.ru
Subject: Re: bug#35224: [PATCH] include indentation size in .dir-locals
Date: Sun, 23 Jun 2019 19:42:57 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> IMO, that's a bug in the configuration of those users because they're
>> overriding how cc-mode works, and the cc-mode manual describes in detail
>> the various ways to customise indentation.  So I don't see a need to
>> change the Emacs dir-locals-file to accommodate this use-case.
>> 
>> But that's just one opinion, and I'm not familiar with prevailing policy
>> on what to add to the Emacs dir-locals-file.
>
> I don't think we have any definitive policy, but FWIW, I agree with
> Basil on this one.
>
> Does anyone else have an opinion?

Didn't look like it, so I guess the majority were against this change.
So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 17:44:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35224 <at> debbugs.gnu.org and Konstantin Kharlamov <Hi-Angel <at> yandex.ru> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 17:44:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.