From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?7KGw7ISx67mI?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] cc-mode: don't tread dir-local and file-local variables differently Date: Tue, 26 May 2020 11:13:30 +0900 Message-ID: <707C4631-BDDF-4938-961E-94C0E9ABC0F3@icloud.com> References: <20200512194516.83180-1-mina86@mina86.com> <20200513184745.GA8857@ACM> <20200517142327.GA12554@ACM> <20200525184412.GA8662@ACM> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="67479"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , bug-cc-mode@gnu.org, emacs-devel@gnu.org To: =?utf-8?Q?Micha=C5=82_Nazarewicz?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 26 04:14:12 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdP6a-000HSq-E1 for ged-emacs-devel@m.gmane-mx.org; Tue, 26 May 2020 04:14:12 +0200 Original-Received: from localhost ([::1]:38154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdP6Z-0003l8-GA for ged-emacs-devel@m.gmane-mx.org; Mon, 25 May 2020 22:14:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdP66-0002er-4I for emacs-devel@gnu.org; Mon, 25 May 2020 22:13:42 -0400 Original-Received: from mr85p00im-ztdg06011901.me.com ([17.58.23.198]:52118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdP65-0003Xo-C7 for emacs-devel@gnu.org; Mon, 25 May 2020 22:13:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1590459215; bh=ZKEhtCY26YN/i9xCPXqywbroitRn9nJSwfzeUECLdZw=; h=Content-Type:Subject:From:Date:Message-Id:To; b=GVBjjg1AkKBhB9BIpiEdE9PC23RVHx4kT00eP5mUaZGmuKvFeNDdhtAso2NAfoNn0 zLC8I93qe9g4602rBo/t5Wte0q+F3FuWyVVvvjQI7TipiTpzSelEHMcNIK2OzLodp6 mOSvzt+9mNSL/QBt6ksDyvH7dTV7A1rWflYjKjyHJOQMWiP7oEnx0/Lhh6ePSOWhix gqRhLKyEQu+cmg6b1Lf8SCTXggoXtBoyoKLX6K4FzxrdnzirfzuMpY4OlbgC3EUZ+o kFyMsrdlJzpg8MqgTMGnPy5qcEzOYCxQxTCYmHmcFkNu8VbVF3ii12wE945qvXcyZe bcxrjdRSARXog== Original-Received: from [10.56.216.34] (unknown [128.134.203.66]) by mr85p00im-ztdg06011901.me.com (Postfix) with ESMTPSA id 468A4A6049F; Tue, 26 May 2020 02:13:34 +0000 (UTC) In-Reply-To: X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-05-25_10:2020-05-25, 2020-05-25 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=761 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2002250000 definitions=main-2005260014 Received-SPF: pass client-ip=17.58.23.198; envelope-from=pcr910303@icloud.com; helo=mr85p00im-ztdg06011901.me.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/25 22:13:35 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, KHOP_DYNAMIC=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251410 Archived-At: Michał Nazarewicz 작성: > 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.