From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorgen Schaefer Newsgroups: gmane.emacs.devel Subject: Re: A unified project root interface Date: Sun, 10 Mar 2013 11:06:42 +0100 Message-ID: <20130310110642.11fbcc2b@forcix.kollektiv-hamburg.de> References: <20130309174419.6e1cadb4@forcix.kollektiv-hamburg.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1362910011 5388 80.91.229.3 (10 Mar 2013 10:06:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Mar 2013 10:06:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 10 11:07:14 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UEd9t-0002MG-FR for ged-emacs-devel@m.gmane.org; Sun, 10 Mar 2013 11:07:13 +0100 Original-Received: from localhost ([::1]:45391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEd9X-0003Wu-Ba for ged-emacs-devel@m.gmane.org; Sun, 10 Mar 2013 06:06:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEd9U-0003Wl-7p for emacs-devel@gnu.org; Sun, 10 Mar 2013 06:06:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEd9T-0007Ah-0o for emacs-devel@gnu.org; Sun, 10 Mar 2013 06:06:48 -0400 Original-Received: from istinn.electusmatari.com ([83.169.37.145]:44856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEd9S-0007AJ-QY for emacs-devel@gnu.org; Sun, 10 Mar 2013 06:06:46 -0400 Original-Received: from forcix.kollektiv-hamburg.de (hmbg-5f765ece.pool.mediaWays.net [95.118.94.206]) by istinn.electusmatari.com (Postfix) with ESMTPSA id 57746D10001E; Sun, 10 Mar 2013 11:06:45 +0100 (CET) In-Reply-To: X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; i486-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 83.169.37.145 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157685 Archived-At: On Sun, 10 Mar 2013 00:38:12 -0500 Stefan Monnier wrote: > > So this is my somewhat verbose request to say "yes, let's do this" > > and pick a library to provide the functionality. > > Agreed. > > [...] > > If the only need is to figure out the "root directory of the project", That is I think the minimum requirement, yes. > then maybe a simple solution is: > > (defvar project-root-predicate > (lambda () (file-exists-p ".dir-locals.el"))) > (defun project-root () > (locate-dominating-file default-directory > project-root-predicate)) > > where packages can (add-function :until-before (default-value > project-root-predicate) ) to recognize other "tell tale > sign" of a project root (e.g. a Tupfile). This would indeed be the minimal set to help with the problem. I think it's a bit *too* minimal, because it fails for most common cases, i.e. those where the project root is not defined yet. Every package trying to use it will need to extend it with some way to define or set the project root before this code can be used at all. The project.el files I linked to (and most projects) by default look for VCS markers to find the project root if nothing else is specified. This might be trivial enough to add by default, too. The only added functionality of the project.el files I linked to is that they allow the user to override the project root (using M-x project-set-root), which in turn makes it worthwhile to have the project root as a buffer-local variable. Regards, -- Jorgen