Re: Creating a custom ede project.
Eric Ludlam <[email protected]> Mon, 01 Jun 2015 13:32:18 -0400
| Newsgroups | gmane.emacs.cedet |
|---|---|
| Message-ID | <[email protected]> |
On 05/28/2015 12:02 PM, Simon Brown wrote:
> Hi all,
>
> I work concurrently on several copies of the same code base spread
> across a few machines, which makes setting up an ede-cpp-root-project
> for each one a bit tedious. I've been toying with creating an ede
> project type for this code base for some time and have recently been
> having another go. I'm just after code completion at the moment, nothing
> fancy.
>
> My elisp and eieio skills aren't that great though and I'm currently
> stuck with an eieio error that I don't know how to debug, something is
> unbound, but I don't know how to deduce what. I also don't know if I
> should be concerned about the project being unsafe.
>
> I've attached the backtrace and the elisp for the project. The elisp is
> badly butchered from the linux project type. The anchor project type is
> just a test code base, one include file in /include and one source file
> in /src.
>
> Any hints or suggestions?
Howdy,
The way cpp-root projects work changed significantly in CEDET/git, which
I think made it up into Emacs git. The old mechanism which I think your
version uses is a bit tricker to setup, but if you did a copy/rename of
linux you should be ok.
The bug you encountered with 'unbound is odd since the text 'unbound
isn't in your file. The unbound symbol is a special thing created in
eieio. If eieio-unbound variable was reset after instantiating your
class, I think that error would occur. I suppose also if you were
mixing an older CEDET and newer Emacs w/ built-in eieio that could
happen, but then nothing would be working.
Based on your short description however, I think you can do something
much easier, tuned for your system, and that should work even as you
transition from older EDE to the newer version. The text is in the
comments of ede/cpp-root.el in the commentary under "Advanced Example".
If all your code is always in a directory called MOOSE, because the
moose project is awesome, or perhaps MOOSE-ver, then you can write a
little function such as this untested code nugget:
(defun moose-project-root (&optional dir)
"Get the root directory for DIR."
(when (not dir) (setq dir default-directory))
(let ((case-fold-search t))
(when (string-match "/moose[^/]*" dir)
(let ((base (substring dir 0 (match-end 0))))
(when (file-exists-p (expand-file-name "src/moose.c" base))
base)))))
and then write a loader as per the commentary (don't worry about the
locate-fcn), I think you should be ok. The magic is that cpp-root
should end up finding existing projects for you, and this loader will
find projects for anything that hasn't been discovered yet.
There are a lot of other services in ede though, so if you want to use
them you'll probably want to update to the the latest version and
continue designing your own project.
Eric
------------------------------------------------------------------------------