From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: files.el: Patch to make project-settings optional/customizable Date: Sun, 23 Nov 2008 00:10:06 -0800 (PST) Message-ID: <200811230810.mAN8A6fp022636@mothra.ics.uci.edu> References: <5f0ff9220811130629t505badf9kb1bcc380df89a08f@mail.gmail.com> <200811131619.mADGJukm010206@mothra.ics.uci.edu> <87prkz4kgh.fsf@cyd.mit.edu> <200811131728.mADHSH2M010654@mothra.ics.uci.edu> <871vxflbxb.fsf@cyd.mit.edu> <200811131848.mADImPMQ011099@mothra.ics.uci.edu> <200811181636.mAIGa9Lx000571@mothra.ics.uci.edu> <87prks6693.fsf@jurta.org> <87iqqjcp3j.fsf@jurta.org> <87zljrh93w.fsf@jurta.org> <200811221940.mAMJeMpj020419@mothra.ics.uci.edu> <87ej13h73g.fsf@jurta.org> <200811222020.mAMKKBcY020496@mothra.ics.uci.edu> <87zljrm7yh.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1227428083 6223 80.91.229.12 (23 Nov 2008 08:14:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Nov 2008 08:14:43 +0000 (UTC) Cc: Juri Linkov , Tom Tromey , "T.V. Raman" , emacs-devel@gnu.org, Miles Bader To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 23 09:15:44 2008 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 1L4A88-00032K-IU for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 09:15:44 +0100 Original-Received: from localhost ([127.0.0.1]:57586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4A6z-0000u6-8n for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 03:14:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L4A6n-0000pM-PM for emacs-devel@gnu.org; Sun, 23 Nov 2008 03:14:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L4A6m-0000ol-DU for emacs-devel@gnu.org; Sun, 23 Nov 2008 03:14:21 -0500 Original-Received: from [199.232.76.173] (port=51406 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4A6m-0000of-8Q for emacs-devel@gnu.org; Sun, 23 Nov 2008 03:14:20 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:55923) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L4A3Q-0004bm-Tk; Sun, 23 Nov 2008 03:10:54 -0500 Original-Received: from sallyv2.ics.uci.edu ([128.195.1.120]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L4A3P-0001iW-W5; Sun, 23 Nov 2008 03:10:52 -0500 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id mAN8A8FA013957; Sun, 23 Nov 2008 00:10:09 -0800 (PST) Original-Received: (from dann@localhost) by mothra.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id mAN8A6fp022636; Sun, 23 Nov 2008 00:10:06 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sun, 23 Nov 2008 00:27:11 -0500") Original-Lines: 49 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: mAN8A8FA013957 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-kernel: by mx20.gnu.org: Solaris 10 (beta) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:106014 Archived-At: Stefan Monnier writes: > > I agree it does feel like that, but still, making it a defconst seems > > like the tasteful thing to do... > > We could make it read-only, like we do for t, nil, :toto, and > enable-multibyte-characters. Or just get rid of the defconst. Let's look at the code in question: (defconst dir-locals-file ".dir-locals.el" "File that contains directory-local variables. It has to be constant to enforce uniform values across different environments and users.") (defun dir-locals-find-file (file) "Find the directory-local variables FILE. This searches upward in the directory tree. If a local variables file is found, the file name is returned. If the file is already registered, a cons from `dir-locals-directory-alist' is returned. Otherwise this returns nil." (setq file (expand-file-name file)) (let ((locals-file (locate-dominating-file file dir-locals-file)) (dir-elt nil)) ;; `locate-dominating-file' may have abbreviated the name. (when locals-file (setq locals-file (expand-file-name dir-locals-file locals-file))) (dolist (elt dir-locals-directory-alist) (when (and (eq t (compare-strings file nil (length (car elt)) (car elt) nil nil)) (> (length (car elt)) (length (car dir-elt)))) (setq dir-elt elt))) (if (and locals-file dir-elt) (if (> (length (file-name-directory locals-file)) (length (car dir-elt))) locals-file dir-elt) (or locals-file dir-elt)))) So there are 2 uses .dir-locals.el 3 lines apart in the same 24 lines function. The defconst adds 4 lines. It's hard to keep a straight face and claim that the defconst is a good idea. (and the 2 uses could be reduced to a single one if we make locate-dominating-file return an expanded file name -- which seems to be a good idea anyway). It's kind of painful that this discussion is still going on, it should have never occurred in the first place...