From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vagn Johansen Newsgroups: gmane.emacs.devel Subject: Re: project variable patch #2 Date: Mon, 10 Sep 2007 20:07:16 +0200 Message-ID: References: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1189484207 16718 80.91.229.10 (11 Sep 2007 04:16:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2007 04:16:47 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 11 06:15:10 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1IUx9G-0008QL-JU for ged-emacs-devel@m.gmane.org; Tue, 11 Sep 2007 06:14:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUxAc-0004wL-Sy for ged-emacs-devel@m.gmane.org; Tue, 11 Sep 2007 00:16:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IUxAZ-0004uC-2R for emacs-devel@gnu.org; Tue, 11 Sep 2007 00:16:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IUxAX-0004tX-Fq for emacs-devel@gnu.org; Tue, 11 Sep 2007 00:16:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IUxAX-0004tL-8e for emacs-devel@gnu.org; Tue, 11 Sep 2007 00:16:09 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IUxAW-0005Ku-OP for emacs-devel@gnu.org; Tue, 11 Sep 2007 00:16:09 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IUx1J-0003H4-G3 for emacs-devel@gnu.org; Tue, 11 Sep 2007 06:06:37 +0200 Original-Received: from 0x5551567a.adsl.cybercity.dk ([85.81.86.122]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Sep 2007 06:06:37 +0200 Original-Received: from gonz808 by 0x5551567a.adsl.cybercity.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Sep 2007 06:06:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 0x5551567a.adsl.cybercity.dk User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt) Cancel-Lock: sha1:bPQ2dr5F2vBK5rUZeOfjUvy+fbw= X-Detected-Kernel: 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:78557 Archived-At: Tom Tromey writes: > Here's the next revision of patch that used to be "project.el". > +(defun project-find-settings-file (file) > + (while (and (not (string= dir "/")) > + (not result)) > + (cond > + ((setq result (assoc dir project-directory-alist)) > + ;; Nothing else. > + nil) > + ((file-exists-p (concat dir ".dir-settings.el")) > + (setq result (concat dir ".dir-settings.el"))) > + (t > + (setq dir (file-name-directory (directory-file-name dir)))))) > + result)) This can cause infinite loops on windows because the dir variable will end up as c:/ and the setq dir at the bottom will set it to c:/ again. > +(defun project-filter-risky-variables (alist) > + (setcdr sub-alist > + (project-filter-risky-variables (cdr sub-alist))) > + ;; Remove unsafe variables by setting their cars to nil. > + (dolist (sub-elt sub-alist) > + (unless (safe-local-variable-p (car sub-elt) (cdr sub-elt)) > + (setcar sub-elt nil))) > + ;; Now remove all the deleted risky variables. > + (setcdr elt (assq-delete-all nil sub-alist))))) > + alist) > + This can silently ignore settings. Take a look at hack-local-variables-confirm in files.el to see how this is handled for Local Variables. -- Vagn Johansen