From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Blunderbuss ".dir-locals.el" raises everything in its path!! Date: Sun, 12 Jul 2009 18:06:23 +0000 Message-ID: <20090712180623.GA1009@muc.de> References: <20090712144137.GB2524@muc.de> <87hbxhony6.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1247421887 3583 80.91.229.12 (12 Jul 2009 18:04:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Jul 2009 18:04:47 +0000 (UTC) Cc: Jan =?iso-8859-1?Q?Dj=E4rv?= , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 12 20:04:40 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MQ3Pj-0005pm-NH for ged-emacs-devel@m.gmane.org; Sun, 12 Jul 2009 20:04:40 +0200 Original-Received: from localhost ([127.0.0.1]:41723 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQ3Pj-0007eN-5u for ged-emacs-devel@m.gmane.org; Sun, 12 Jul 2009 14:04:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQ3Pd-0007dD-LU for emacs-devel@gnu.org; Sun, 12 Jul 2009 14:04:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQ3PY-0007Xx-Mp for emacs-devel@gnu.org; Sun, 12 Jul 2009 14:04:33 -0400 Original-Received: from [199.232.76.173] (port=54099 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQ3PY-0007Xo-HU for emacs-devel@gnu.org; Sun, 12 Jul 2009 14:04:28 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:1985 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MQ3PX-0007MM-Sv for emacs-devel@gnu.org; Sun, 12 Jul 2009 14:04:28 -0400 Original-Received: (qmail 37620 invoked by uid 3782); 12 Jul 2009 18:04:26 -0000 Original-Received: from acm.muc.de (pD9E539F5.dip.t-dialin.net [217.229.57.245]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 12 Jul 2009 20:04:23 +0200 Original-Received: (qmail 1051 invoked by uid 1000); 12 Jul 2009 18:06:23 -0000 Content-Disposition: inline In-Reply-To: <87hbxhony6.fsf@stupidchicken.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:112372 Archived-At: On Sun, Jul 12, 2009 at 12:39:29PM -0400, Chong Yidong wrote: > Alan Mackenzie writes: > > Surely .dir-locals.el should, in some fashion, supply defaults which > > may be overridden by mode hooks and the like. It is almost, but not > > quite, entirely unlike file local settings, a rarely used precision > > instrument. > I'm not sure I understand. Directory-local variables are processed > right before file-local variables, and can be overridden by them. Sorry, yes. But that's the only thing they can be overridden by. That is surely not the right thing. Consider the variable c-cleanup-list which Jan though he was setting. Here is a list of the ways of setting it (taken from the CC Mode manual, page "Config Basics"), disregarding for now .dir-locals.el: Style Top-level command or "customization interface" Hook File Style [Explicit setting in file local variables] , in increasing order of precedence. This order seems sensible, IMO. In particular, the File Style and local variables settings are rarely used precision instruments, for configuring unusual files unusually. Now add .dir-locals into the mix: Style Top-level command or "customization interface" Hook .dir-locals.el <===================== File Style [Explicit setting in file local variables] Why on earch does .dir-locals.el take precedence over values set in a top-level `setq' or `c-mode-hook'? This is surely the Wrong Thing to do. Jan hat set his own desired value of c-cleanup-list (as a top-level command), only to have it obliterated by this line: (c-mode . ((c-file-style . "GNU"))) in .dir-locals.el. > See `hack-local-variables'---the code merely adds extra variables to > the file-local-variables-alist, defined in .dir-locals.el files, > before Emacs adds those defined in the visited file itself. The local > variables are then processed in order, wrapped by > before/after-hack-local-variables-hook. > Could you try to dig deeper and figure out the problem? Yes, we both agree on what is happening. My point is that the contents of .dir-locals.el should not override explicit values given by the user in his .emacs. -- Alan Mackenzie (Nuremberg, Germany).