From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Patch: Blunderbuss ".dir-locals.el" raises everything in its path!! Date: Wed, 15 Jul 2009 16:49:03 -0400 Message-ID: <87skgxhdts.fsf@stupidchicken.com> References: <20090712144137.GB2524@muc.de> <87hbxhony6.fsf@stupidchicken.com> <20090712180623.GA1009@muc.de> <87k52dycha.fsf@stupidchicken.com> <4A5AC184.5050805@gnu.org> <20090714162206.GC1718@muc.de> <20090714201150.GA1631@muc.de> <4A5D8B7F.6050603@swipnet.se> <20090715190005.GA2380@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1247691040 9578 80.91.229.12 (15 Jul 2009 20:50:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jul 2009 20:50:40 +0000 (UTC) Cc: Jan =?utf-8?Q?Dj=C3=A4rv?= , emacs-devel@gnu.org, Stefan Monnier , Jason Rumney To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 15 22:50:33 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 1MRBQt-0002zn-KY for ged-emacs-devel@m.gmane.org; Wed, 15 Jul 2009 22:50:31 +0200 Original-Received: from localhost ([127.0.0.1]:43824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRBQt-00068A-1x for ged-emacs-devel@m.gmane.org; Wed, 15 Jul 2009 16:50:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRBQp-000682-9E for emacs-devel@gnu.org; Wed, 15 Jul 2009 16:50:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRBQk-00067X-OP for emacs-devel@gnu.org; Wed, 15 Jul 2009 16:50:26 -0400 Original-Received: from [199.232.76.173] (port=55609 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRBQk-00067U-IV for emacs-devel@gnu.org; Wed, 15 Jul 2009 16:50:22 -0400 Original-Received: from pantheon-po38.its.yale.edu ([130.132.50.97]:41716) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MRBQg-0007vo-Ud; Wed, 15 Jul 2009 16:50:19 -0400 Original-Received: from furry (dhcp128036014244.central.yale.edu [128.36.14.244]) (authenticated bits=0) by pantheon-po38.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id n6FKnCow012862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Jul 2009 16:49:38 -0400 Original-Received: by furry (Postfix, from userid 1000) id 4C856C09B; Wed, 15 Jul 2009 16:49:04 -0400 (EDT) In-Reply-To: <20090715190005.GA2380@muc.de> (Alan Mackenzie's message of "Wed, 15 Jul 2009 19:00:05 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.96 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:112504 Archived-At: Alan Mackenzie writes: > In particular, there's no great care taken about how the local variable > settings from the two sources get combined. This has little to do with directory-local variables; if you specify a file-local variable more than once in the file, the same thing occurs. > How about the following idea: when a setting from the Local Variables: > section is to be pushed onto file-local-variables-alist, any exisiting > element for the same variable is first removed? This sounds reasonable. Something like this should work: *** trunk/lisp/files.el.~1.1055.~ 2009-07-12 13:32:43.000000000 -0400 --- trunk/lisp/files.el 2009-07-15 16:43:59.000000000 -0400 *************** *** 2960,2966 **** (dolist (elt variables) (unless (or (member elt unsafe-vars) (member elt risky-vars)) ! (push elt file-local-variables-alist))) ;; Query, unless all are known safe or the user wants no ;; querying. (if (or (and (eq enable-local-variables t) --- 2960,2970 ---- (dolist (elt variables) (unless (or (member elt unsafe-vars) (member elt risky-vars)) ! (let ((var (car elt))) ! (unless (eq var 'eval) ! (setq file-local-variables-alist ! (assq-delete-all var file-local-variables-alist))) ! (push elt file-local-variables-alist)))) ;; Query, unless all are known safe or the user wants no ;; querying. (if (or (and (eq enable-local-variables t) *************** *** 2970,2976 **** (hack-local-variables-confirm variables unsafe-vars risky-vars dir-name)) (dolist (elt variables) ! (push elt file-local-variables-alist))))))) (defun hack-local-variables (&optional mode-only) "Parse and put into effect this buffer's local variables spec. --- 2974,2985 ---- (hack-local-variables-confirm variables unsafe-vars risky-vars dir-name)) (dolist (elt variables) ! (let ((var (car elt))) ! (unless (eq var 'eval) ! (setq file-local-variables-alist ! (assq-delete-all var file-local-variables-alist))) ! (push elt file-local-variables-alist)))))))) ! (defun hack-local-variables (&optional mode-only) "Parse and put into effect this buffer's local variables spec.