emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cc-mode: don't tread dir-local and file-local variables diff


From: 조성빈
Subject: Re: [PATCH] cc-mode: don't tread dir-local and file-local variables differently
Date: Tue, 26 May 2020 11:13:30 +0900

Michał Nazarewicz <address@hidden> 작성:

To quickly recap, CC Mode treats ‘c-file-style’ differently depending on
whether it comes from .dir-locals.el or a file-local variable.  For
example, having the following in init.el:

    (setq-default 'c-basic-offset 4)

consider the following two scenarios:

1) /tmp/foo/.dir-locals.el exists and contains a single line:

       ((nil . ((c-file-style . "bsd"))))

   Opening an empty /tmp/foo/foo.c file results in ‘c-basic-offset’
   being four and ‘c-file-style’ being "bsd".

2) /tmp/bar/.dir-locals.el does not exist but /tmp/bar/bar.c does and
   contains a single line:

       /* -*- c-file-style: "bsd" -*- */

   Opening that file results in ‘c-basic-offset’ being eight and
   ‘c-file-style’ being "bsd".  (Value of eight for the offset comes
   from "bsd" style).

I maintain that in both cases ‘c-basic-offset’ should be the same.
I further maintain that its value should be eight.  Alan disagrees and
maintains that cc-mode-hook should overwrite settings in dir-local
variables but should be overwritten by settings in file-local variables.

As a user I think most people would expect the two results to be the same - the biggest use case of {dir,file}-local variables (at least known to me) is to maintain a consistent style between different Emacs customizations.

The person that added .dir-locals.el would have expected that all code inside this directory will follow the bsd-style — one should not have to consider various different customization scenarios and accommodate to them to have a consistent style.



reply via email to

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