[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A unified project root interface

From: David Engster
Subject: Re: A unified project root interface
Date: Wed, 20 Mar 2013 17:34:09 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.93 (gnu/linux)

Stefan Monnier writes:
>>> That might require splitting EIEIO, or some other approach, maybe,
>>> I don't know.
>> I don't think that's a practical approach. In EDE, a project *is* a
>> class.
> [ Actually, there are various reasons to split EIEIO, one of them would
>   be to try and fix the eval-and-compile mess.  ]

What do you mean by "splitting EIEIO"? Into what parts?

>> I would however like to ask if such a 'project-root' feature is
>> absolutely needed right at startup time. I'm not sure about the overhead
>> involved when loading files, which might be annoying to people who don't
>> need it. OTOH, we already have vc-find-file-hook enabled by default,
>> which I guess renders such questions moot...
> Right, one possible approach is to try and delay the use of
> project-root, as is done for VC: have a preloaded ede-hooks.el file
> which is just enough to try and detect projects that use EDE, and then
> only load EDE if/when opening a file in such a project.

This won't work; you cannot detect whether a file is part of a project
without the project's definition (which comes in the form of a class, as
I've already written). It's a chicken/egg thing. Yes, there are projects
which save their state in a file 'Project.ede'; these could be detected,
but that's a special case.

So again, if such a 'project-root' feature is needed at startup, EDE is
out. Separating EDE from EIEIO would mean rewriting it.

Instead, I'd vote for a very simple approach which at least takes EDE
projects into account, among other things. Roughly like this:

(defun project-root-ede (file)
  (when (and (featurep' ede)
             (with-current-buffer file
    ... return EDE root ... ))

(defun project-root-vc (file)
  (when (vc-file-registered file)
    ... return root from VC ... ))

(defvar project-root-detect-functions 
          '(project-root-ede project-root-vc))

(defun project-root ()
       (buffer-file-name (current-buffer))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]