unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35224: [PATCH] include indentation size in .dir-locals
@ 2019-04-11  1:10 Konstantin Kharlamov
  2019-04-11  2:16 ` Basil L. Contovounesios
  0 siblings, 1 reply; 10+ messages in thread
From: Konstantin Kharlamov @ 2019-04-11  1:10 UTC (permalink / raw)
  To: 35224

* .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






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11  1:10 bug#35224: [PATCH] include indentation size in .dir-locals Konstantin Kharlamov
@ 2019-04-11  2:16 ` Basil L. Contovounesios
  2019-04-11  6:24   ` Konstantin Kharlamov
  0 siblings, 1 reply; 10+ messages in thread
From: Basil L. Contovounesios @ 2019-04-11  2:16 UTC (permalink / raw)
  To: Konstantin Kharlamov; +Cc: 35224

Konstantin Kharlamov <Hi-Angel@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11  2:16 ` Basil L. Contovounesios
@ 2019-04-11  6:24   ` Konstantin Kharlamov
  2019-04-11 10:26     ` Basil L. Contovounesios
  0 siblings, 1 reply; 10+ messages in thread
From: Konstantin Kharlamov @ 2019-04-11  6:24 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35224



On Чт, Apr 11, 2019 at 03:16, Basil L. Contovounesios 
<contovob@tcd.ie> wrote:
> Konstantin Kharlamov <Hi-Angel@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.







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11  6:24   ` Konstantin Kharlamov
@ 2019-04-11 10:26     ` Basil L. Contovounesios
  2019-04-11 10:39       ` Konstantin Kharlamov
  0 siblings, 1 reply; 10+ messages in thread
From: Basil L. Contovounesios @ 2019-04-11 10:26 UTC (permalink / raw)
  To: Konstantin Kharlamov; +Cc: 35224

severity 35224 wishlist
quit

Konstantin Kharlamov <hi-angel@yandex.ru> writes:

> On Чт, Apr 11, 2019 at 03:16, Basil L. Contovounesios <contovob@tcd.ie> wrote:
>> Konstantin Kharlamov <Hi-Angel@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 10:26     ` Basil L. Contovounesios
@ 2019-04-11 10:39       ` Konstantin Kharlamov
  2019-04-11 10:58         ` Basil L. Contovounesios
  0 siblings, 1 reply; 10+ messages in thread
From: Konstantin Kharlamov @ 2019-04-11 10:39 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35224



On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios 
<contovob@tcd.ie> wrote:
> severity 35224 wishlist
> quit
> 
> Konstantin Kharlamov <hi-angel@yandex.ru> writes:
> 
>>  On Чт, Apr 11, 2019 at 03:16, Basil L. Contovounesios 
>> <contovob@tcd.ie> wrote:
>>>  Konstantin Kharlamov <Hi-Angel@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.







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 10:39       ` Konstantin Kharlamov
@ 2019-04-11 10:58         ` Basil L. Contovounesios
  2019-04-11 13:30           ` Eli Zaretskii
  2019-04-11 13:56           ` Konstantin Kharlamov
  0 siblings, 2 replies; 10+ messages in thread
From: Basil L. Contovounesios @ 2019-04-11 10:58 UTC (permalink / raw)
  To: Konstantin Kharlamov; +Cc: 35224

Konstantin Kharlamov <hi-angel@yandex.ru> writes:

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 10:58         ` Basil L. Contovounesios
@ 2019-04-11 13:30           ` Eli Zaretskii
  2019-06-23 17:42             ` Lars Ingebrigtsen
  2019-04-11 13:56           ` Konstantin Kharlamov
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2019-04-11 13:30 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35224, hi-angel

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Date: Thu, 11 Apr 2019 11:58:37 +0100
> Cc: 35224@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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 10:58         ` Basil L. Contovounesios
  2019-04-11 13:30           ` Eli Zaretskii
@ 2019-04-11 13:56           ` Konstantin Kharlamov
  2019-04-11 15:22             ` Basil L. Contovounesios
  1 sibling, 1 reply; 10+ messages in thread
From: Konstantin Kharlamov @ 2019-04-11 13:56 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35224



On Чт, Apr 11, 2019 at 11:58, Basil L. Contovounesios 
<contovob@tcd.ie> wrote:
> Konstantin Kharlamov <hi-angel@yandex.ru> writes:
> 
>>  On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios 
>> <contovob@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







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 13:56           ` Konstantin Kharlamov
@ 2019-04-11 15:22             ` Basil L. Contovounesios
  0 siblings, 0 replies; 10+ messages in thread
From: Basil L. Contovounesios @ 2019-04-11 15:22 UTC (permalink / raw)
  To: Konstantin Kharlamov; +Cc: 35224

Konstantin Kharlamov <hi-angel@yandex.ru> writes:

> On Чт, Apr 11, 2019 at 11:58, Basil L. Contovounesios <contovob@tcd.ie> wrote:
>> Konstantin Kharlamov <hi-angel@yandex.ru> writes:
>>
>>>  On Чт, Apr 11, 2019 at 11:26, Basil L. Contovounesios <contovob@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#35224: [PATCH] include indentation size in .dir-locals
  2019-04-11 13:30           ` Eli Zaretskii
@ 2019-06-23 17:42             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 17:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Basil L. Contovounesios, 35224, hi-angel

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-06-23 17:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-11  1:10 bug#35224: [PATCH] include indentation size in .dir-locals Konstantin Kharlamov
2019-04-11  2:16 ` Basil L. Contovounesios
2019-04-11  6:24   ` Konstantin Kharlamov
2019-04-11 10:26     ` Basil L. Contovounesios
2019-04-11 10:39       ` Konstantin Kharlamov
2019-04-11 10:58         ` Basil L. Contovounesios
2019-04-11 13:30           ` Eli Zaretskii
2019-06-23 17:42             ` Lars Ingebrigtsen
2019-04-11 13:56           ` Konstantin Kharlamov
2019-04-11 15:22             ` Basil L. Contovounesios

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).