From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sudish Joseph Newsgroups: gmane.emacs.devel Subject: Re: A unified project root interface Date: Tue, 12 Mar 2013 11:34:05 -0400 Message-ID: References: <20130309174419.6e1cadb4@forcix.kollektiv-hamburg.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363102463 30318 80.91.229.3 (12 Mar 2013 15:34:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Mar 2013 15:34:23 +0000 (UTC) Cc: emacs-devel@gnu.org, Jorgen Schaefer To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 12 16:34:47 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 1UFRDz-0000uf-0t for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2013 16:34:47 +0100 Original-Received: from localhost ([::1]:36481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFRDc-0003zi-IO for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2013 11:34:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFRDQ-0003jC-P7 for emacs-devel@gnu.org; Tue, 12 Mar 2013 11:34:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFRDM-0004Y5-C3 for emacs-devel@gnu.org; Tue, 12 Mar 2013 11:34:12 -0400 Original-Received: from mail-yh0-x235.google.com ([2607:f8b0:4002:c01::235]:40188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFRDM-0004Y1-7L for emacs-devel@gnu.org; Tue, 12 Mar 2013 11:34:08 -0400 Original-Received: by mail-yh0-f53.google.com with SMTP id q3so824611yhf.40 for ; Tue, 12 Mar 2013 08:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=WByl4iSDXFs+MfJfCLh6bBd0PTeQXItL6rFV/KfFdtg=; b=WS8z4IBc8JB4K+dUys840BPYc5fVnI6ixnXs15O1CkfEbSaEB42889+OZBJNMzmJlB TeNZaznM/35/smfwRhdZkwl3zL2ls2JylKhOri4uSlRYCcGYYp7gwi+W05SLuxf+VDg/ cs53jbMxdYFMNAwt/yG7n8FDwFkm4RNY/AiAUYS7EdkMWzbXJR+vP28Jtfq2u6aj3mPP aq0B77InAYdxQV0xfR6UB6HKH03tsWeW2IMqgQVNv4uZLrsF7nEj3f+t/EbnDyveSkOc fNBdcn2N25LPFXdzpxr+OsfE5fLpPN9YcYcVsdZ8aC+b6gJPBYriAgi2Z3omeSA39ziw 7dbQ== X-Received: by 10.236.148.50 with SMTP id u38mr9020055yhj.18.1363102447551; Tue, 12 Mar 2013 08:34:07 -0700 (PDT) Original-Received: from ehost-services149.com (ip-66-147-172-7.incomm.com. [66.147.172.7]) by mx.google.com with ESMTPS id d80sm30122832yhg.4.2013.03.12.08.34.06 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 08:34:06 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 10 Mar 2013 00:38:12 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c01::235 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:157779 Archived-At: Using .dir-locals as the definition of a project is eminently reasonable, but it'd be good if projects and their roots could also be computed dynamically or definitely implicitly from the context of an action. Computable roots: - VC root directories define the most natural project roots in many cases. This is by far the common case for me: look for the .git/ directory. - File and directory existence checks. Rails projects contain these directories at their root: app, config, db. Perl used to contain t and lib, though it's been a while. It'd be good if Emacs didn't require or even write any context of its own into these directories like most IDEs do - there's no reason to. Implicit roots: - Emacsclient should generate an implicit project root if given a directory as an argument. - Drag and drop a directory into Emacs. This used to be one of Textmate's killer features - easy project creation. Emacs doesn't need to define all this, just provide standard hooks to let the user or external packages define this. What would be great would be if the grep interfaces and such could look for and use project roots if one is found. Here's the definition of projects I'm using right now: (setq project-roots `(("Rails Project" :root-contains-files ("app" "config" "db" "lib" "script" "test") :on-hit (lambda (p) (message (car p)))) ("Emacs config" :path-matches ,(format "\\(%s\\)" sj/emacs-base-dir) :on-hit (lambda (p) (message (car p)))) ("Perl Project" :root-contains-files ("t" "lib") :on-hit (lambda (p) (message (car p)))) ("Git Project" :root-contains-files (".git") :on-hit (lambda (p) (message (car p)))))) That's for project-root.el - selected because it was the only one I found at the time. The default .git rule turns out to be the most useful and catches most projects. Here's an example of a package that groups buffers by vc root that could do an even better job with a standardized project interface in Emacs itself: https://github.com/purcell/ibuffer-vc Cheers, -Sudish