unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eric Ludlam <eric@siege-engine.com>,
	Emacs Development <emacs-devel@gnu.org>
Subject: Re: progmodes/project.el and search paths
Date: Tue, 4 Aug 2015 01:47:02 +0300	[thread overview]
Message-ID: <55BFEF66.1090505@yandex.ru> (raw)
In-Reply-To: <55BEC1B5.6060204@gmail.com>

Sorry for the late reply.

On 08/03/2015 04:19 AM, Eric Ludlam wrote:

> I apologize for not being up on the full thread.  It was very long and I
> didn't really get what the goals were.

I would be lying if I said I got everything figured out. One "unified 
project interface" proposal surfaced a while back, and eventually 
fizzled out. I decided to revisit the subject when I was writing a 
couple of commands that needed some information about the current 
project, and here we are.

Those turned out to be pretty useful, by the way.

> One of my hopes for Emacs is that it will keep tabs on what I'm up to to
> provide useful context relevant feedback when I ask for it.

That sounds like something Flymake or Flycheck would do. Or a completion 
system.

> My
> experience has been that tools that depend on a project to ask what the
> current project is do so a lot.  As such, I cache the current project,
> and current root project as buffer local variables.  Those project
> structures then have relevant meta data as well.  Another tactic is
> initializing each buffer into a project as it is created.  That moves
> search time into a different timing that is less noticeable than
> on-demand when the user makes a request.

IME, (vc-call-backend backend 'root dir) takes a negligible amount of 
time, so we might as well call it once per command. Of course, it might 
be different when using Tramp, but both Tramp and VC do some caching of 
their own. Other project implementations are free to employ their own 
caching methods (might be buffer-local, or if the implementation 
considers that only one project might be enabled at a time, simply in 
its own variables).

> Also, identifying projects should be a service of the core project
> system.  Dependent projects need to provide detection data without
> having Emacs load the full project definition.  That way you can have
> lots of projects types without forcing Emacs to load piles of code that
> you don't need.

Each project-find-functions element is free to only contain the bare 
necessary logic to identify its project type, and autoload the rest only 
as required.

> By way of example, EDE's autoloader does this well, and is wrapped in a
> complex test suite to make sure things don't get loaded when detecting
> projects of a different type.  I re-wrote most of it last year and it is
> much better than it was previously.  Use of 'locate-dominating-file' was
> a big win.

 From a quick glance, it defines some restrictions on how a project 
could be detected, and then adds some reusable logic to optimize that. 
I'm not really clear on what those restrictions are. Maybe we'll want 
them, maybe not, we'll have to see.

> Anyway, all that is just about matching projects.  Projects then also
> have meta data.  Things like compilation configuration, compile
> commands, release commands, include paths, classpaths, and whatnot. I
> don't know what you intend with project meta data.  If there was a
> thread about that, I missed it, sorry.

Probably a generic function called project-atrributes that returns a 
hash. Some keys could be standardized.

includes path and class path roughtly correspond to project-search-path.

> Thanks for the pointer.  My Emacs25 didn't compile when I pulled from
> git today, so I didn't get to try it or go very far beyond reading the
> latest in project.el.

That's odd, I didn't have any particular problems compiling it recently.

> For your implementation in ede.el, you are welcome to use what I wrote.

I'm not sure I understand. There's an implementation there already. Is 
your code better? How?

> I think EDE has a generic API for defining a project.  It probably looks
> big on the outside if you just read the doc where it starts with
> "ede-new",

There is a lot to read there. One of the value propositions of 
project.el is that it's easier to grasp.

Another distinction is that project.el is not an API for defining a 
project. It's an API for doing something with an already-defined project.

> but for most cases, if you enable EDE, it will find your
> Emacs src, Linux src, Cmake based build, etc, and it will magically
> provide that to Semantic's parser, to location functions (if enabled)
> and to taggers like global (if enabled.)   The reason it looks big is
> because those are the things that were needed while I was working on
> other tools that needed project support.  I would guess your system will
> grow to a similar state if you keep adding features needed by tools that
> want a project.  It is a really big task.

Maybe. So far, out of that list, the "information for taggers" seems 
like something that could be exposed in the API. The information that 
Semantic needs is probably not generic enough.

The rest are just project types, with different source directories.

> Someone pointed out on the cedet mailing list recently that the doc (and
> probably the website) is too focused on how EDE can create makefiles
> which most people don't want.  Most questions on my mailing list ask how
> to get some other tool like smart completion in semantic working, and
> when they find out that they just need to turn on EDE, and not use the
> full project management system, they are pretty happy.

That's good. In my experience, the CEDET tools are quite dependent on 
each other. Semantic doesn't work for the languages I use, so a lot of 
value proposition goes out of the window.

>> probably because it doesn't match every kind of project). Projectile
>> seems to the most popular "project implementation" out there.
>
> Projectile is a nice interface for moving around between files.

Some other commands it defines:

projectile-run-shell-command-in-root
projectile-find-tag
projectile-multi-occur
projectile-replace
projectile-regenerate-tags
projectile-grep
projectile-test-project
projectile-run-project

I figure most of them could be re-implemented on top of a generic API.

> Projectile has definitions for
> projects EDE does not have because various CEDET developers haven't
> worked with those tools.  The opposite is probably true too.

Probably. Projectile is also 2675 lines long, in total.

> If EDE is considered specific because it is called ede, or because it
> uses eieio, that would be too bad.  It's purpose is to generically
> detect projects such that anyone could create a new project definition,
> find project metadata, and make it accessible to other tools.  This has
> already happened many times.  Supporting EDE is more difficult than just
> providing a dominating file name because it also wants to find extra
> meta data.  I think that is a pretty generic task also.

All I know for sure is that I find EDE's code hard to read (and CEDET as 
a whole, to be honest), and there are not too many third-party packages 
that have decided to build on EDE. Maybe a simpler API will sway a 
larger crowd.

> One way EDE could be made more generic is to make the 'target' concept
> optional.  Simple ede projects also have to define targets as part of
> the detection and matching system, so making them optional would
> simplify creating new projects types in EDE.

It's pretty hard to take something out of an existing API, or a class 
hierarchy. And you can say these methods are optional, but they still 
take up space, and possible consumers are still going to see them.

> Another way EDE could be made more generic is by having built-in tools
> like the 'compile' command ask EDE how to compile, or by having flymake
> use EDE to autodetect how to run make, or perhaps etags could ask EDE
> where to run etags from, and a host of other options.  I had pulled
> those features out into ede named features to keep things independent
> when CEDET was an independent tool.  I don't see why naming conventions
> couldn't change to make things better.

These sounds like good possible applications for project.el.



  parent reply	other threads:[~2015-08-03 22:47 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-02 13:52 progmodes/project.el and search paths Eric Ludlam
2015-08-02 17:17 ` Dmitry Gutov
2015-08-03  1:19   ` Eric Ludlam
2015-08-03 16:16     ` Stephen Leake
2015-08-03 22:56       ` Dmitry Gutov
2015-08-08 13:07       ` Nix
2015-08-09  5:18         ` Stephen Leake
2015-08-09 12:17           ` David Engster
2015-08-09 15:55             ` Stephen Leake
2015-08-10 11:29               ` David Engster
2015-08-10 16:43                 ` Stephen Leake
2015-08-12 10:10                   ` David Engster
2015-08-12 13:49                     ` Stephen Leake
2015-08-12 15:36                       ` David Engster
2015-08-13 11:53                         ` Nix
2015-08-13 12:05                           ` Dmitry Gutov
2015-08-14 11:52                             ` Eric Ludlam
2015-08-14 22:30                               ` Dmitry Gutov
2015-08-15  0:48                                 ` Eric Ludlam
2015-08-15  7:05                                 ` Eli Zaretskii
2015-08-10 17:12             ` Nix
2015-08-03 22:47     ` Dmitry Gutov [this message]
2015-08-04 11:52       ` Eric Ludlam
2015-08-04 16:09         ` Dmitry Gutov
2015-08-03 13:49   ` David Engster
2015-08-03 14:09     ` Dmitry Gutov
2015-08-03 14:27       ` David Engster
2015-08-03 15:13         ` Dmitry Gutov
2015-08-03 21:35           ` David Engster
2015-08-03 23:21             ` Dmitry Gutov
2015-08-04  8:15               ` David Engster
2015-08-04 13:43               ` Eli Zaretskii
2015-08-04 18:05                 ` Dmitry Gutov
2015-08-04 18:16                   ` Eli Zaretskii
2015-08-04 18:41                     ` Dmitry Gutov
2015-08-04 19:23                       ` Eli Zaretskii
2015-08-04 19:40                         ` João Távora
2015-08-05  2:52                           ` Eli Zaretskii
2015-08-04 20:15                         ` Dmitry Gutov
2015-08-05  2:49                           ` Eli Zaretskii
2015-08-05  6:18                             ` Stephen Leake
2015-08-05 15:08                               ` Eli Zaretskii
2015-08-05 15:36                                 ` Dmitry Gutov
2015-08-05 16:31                                   ` Eli Zaretskii
2015-08-05 16:45                                   ` David Engster
2015-08-05 22:17                                     ` Dmitry Gutov
2015-08-06  7:56                                     ` Stephen Leake
2015-08-06  7:54                                   ` Stephen Leake
2015-08-05  9:42                             ` Dmitry Gutov
2015-08-05 15:23                               ` Eli Zaretskii
2015-08-05 15:31                                 ` Dmitry Gutov
2015-08-05 16:16                                   ` Eli Zaretskii
2015-08-06  6:44                                     ` Dmitry Gutov
2015-08-06  7:43                               ` Stephen Leake
2015-08-06 10:25                                 ` Dmitry Gutov
2015-08-06 14:27                                   ` Stephen Leake
2015-08-06 23:16                                     ` Dmitry Gutov
2015-08-07 14:10                                       ` Stephen Leake
2015-08-07 14:44                                         ` Dmitry Gutov
2015-08-03 16:35         ` Stephen Leake
2015-08-03 16:45           ` Eli Zaretskii
2015-08-03 21:07             ` Stephen Leake
2015-08-03 21:33               ` David Engster
2015-08-04  2:35               ` Eli Zaretskii
2015-08-03 15:09       ` Eli Zaretskii
2015-08-03 15:16         ` Dmitry Gutov
2015-08-03 15:29           ` Eli Zaretskii
2015-08-03 19:01             ` Dmitry Gutov
2015-08-03 19:19               ` Eli Zaretskii
2015-08-03 21:05                 ` Dmitry Gutov
2015-08-04 11:48         ` Eric Ludlam
2015-08-04 16:20           ` Dmitry Gutov
2015-08-03 16:25     ` Stephen Leake
2015-08-03 21:33     ` Stefan Monnier
2015-08-03 22:15       ` David Engster
2015-08-03 22:50         ` Dmitry Gutov
2015-08-04  7:13         ` Stefan Monnier
2015-08-04  8:13           ` David Engster
2015-08-05 13:42             ` Stefan Monnier
2015-08-06 11:27               ` {Spam?} " Eric Ludlam
2015-08-06 23:10                 ` Stefan Monnier
2015-08-07 11:18                   ` Eric Ludlam
2015-08-07 11:43                     ` David Engster
2015-08-07 12:17                       ` Dmitry Gutov
2015-08-07 12:40                         ` David Engster
2015-08-07 12:54                           ` Dmitry Gutov
2015-08-07 12:08                     ` Alexis
2015-08-04  9:40           ` Stephen Leake
2015-08-04 17:43             ` Dmitry Gutov
2015-08-04 19:49               ` Stephen Leake
2015-08-04 20:03                 ` Dmitry Gutov
2015-08-05  6:02                   ` Stephen Leake
2015-08-05  9:59                     ` Dmitry Gutov
2015-08-06  7:25                       ` Stephen Leake
2015-08-07 14:21                         ` Dmitry Gutov
2015-08-05  1:29   ` Eric Ludlam
2015-08-11 20:01     ` Dmitry Gutov
2015-08-12  0:49       ` Eric Ludlam
2015-08-12  7:25         ` project terminology Stephen Leake
2015-08-12  9:28         ` progmodes/project.el and search paths Dmitry Gutov
2015-12-29  2:00     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BFEF66.1090505@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=eric@siege-engine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).