Putting CEDET ede-cpp-root-project commands outside the .emacs file - emacs

I have a working EDE project, but I would like to locate the command in a file in the source tree for that project and not in my .emacs file. Is this possible?
I have tried using directory variables and emacs loads the file, but it does have any affect. To do this I placed the following code in .dir-locals.el in the project root:
((nil
. ((ede-cpp-root-project "MyProj"
:name "MyProj Project"
:file "/home/jlisee/projects/myproj_code/CMakeLists.txt"
:include-path '( "/packages" )
:system-include-path '( "/opt/myproj/local/include" )
:spp-table '( ("CONST" . "const") )
))))

The project type ede-cpp-root is for people who specifically want to keep the project file out of their source tree. If you want a project type in your source tree, there are other options.
If you are using a recent version of CEDET, you can instead enable the generic project types which in turn supports cmake (which it looks like you are using?)
(ede-enable-generic-projects)
Once in this generic project for CMake, use
M-x ede-customize-project RET
to add in include paths, macro tables, and the like.
If you aren't using makefiles, cmake, or whatever, you can create your own generic project type with a bit of code in your .emacs file. Look in ede-generic for everything that mentions CMake, and it should be pretty obvious what 3 things to create.
I think the existing project type uses CMakeLists, not CMakeLists.txt, so perhaps the existing code needs a tweak.

Related

emacs projectile: how to add multiple folders to project (like vscode)?

I am new to emacs, coming from VSCode, trying to setup projectile. So far my configuration includes:
(use-package projectile
:ensure t
:diminish projectile-mode
:config (projectile-mode)
:custom ((projectile-completion-system 'helm))
:bind-keymap
("C-c p" . projectile-command-map)
:init
(when (file-directory-p "/home/user/code")
(setq projectile-project-search-path '("/home/user/code"))))
One of the things I loved in VSCode is the ability to create .code-workspace files. Within such a file, I could specify multiple directories that would be included in my workspace.
The projectile notion of a project (https://docs.projectile.mx/projectile/projects.html) seems to always associate a project with one root directory.
Is there any way in which I could use multiple root directories in a project? Could the .projectile file accomplish the same as the .code-workspace file?

emacs projectile - initialize project cache without git, hg, etc. repository

I want setup the projectile project for project that has no local git, hg, bzr, etc. directories so I cannot use their repositories as source of project files. Is it enough to just create the .projectile file in the root directory and use the C-u C-c p f to refresh the cache. I've tried this and in my case it is not working (my .projectile is empty - shall I fill it with some rules?). What I would expect is the emacs/projectile to automatically index all my project, i.e. directory-by-directory, file-by-file, so I can make later quick search for the files.
Could you please give me some step-by-step hints ?
Thanks!
[--Update--]
This is an excerpt from my .emacs config file:
(require 'projectile)
(projectile-global-mode)
(setq projectile-indexing-method 'native)
(setq projectile-enable-caching t)
After the C-c p f sequence I'm asked by the "Find file:" prompt but the only file in the list is the .projectile file itself - none of the project files are displayed.
Currently, I have found out that after you have created a .projectile file in the directory of your choice, projectile will only use it after you restart emacs from that directory.
The caching is working well.

cedet ede project for emacs

I am trying learn how to work with CEDET. I don't have any project to mess around so I want to shoot Emacs itself.
It seems CEDET automatically detects Emacs as a project when I open Emacs repository in dir. But when I do M-x ede-find-file there is no file to open.
Question is, How can I exactly setup Emacs as a project in CEDET to make use of EDE and other goodies of CEDET.?
Seems the documentation for this hasn't been completed yet.
The command ede-find-file doesn't provide completion. If you are visiting some file in the Emacs source (like INSTALL) and do this:
M-x ede-find-file RET emacs.c RET
it should pop up emacs.c.
Different CEDET features all have different kinds of dependencies so it's hard to answer the question specifically, but generically, all you have to do is visit a file in your Emacs project, and the other features should be enabled.
I think, that it should be added the same way as other EDE projects, with something like:
(setq emacs-project
(ede-emacs-project "emacs-head"
:file "/home/ott/work/emacs-head/README"))
At least this works for me...

How to se the cscope database directory in emacs?

I use cscope with emacs, and it works well, but it creates cscope.out and cscope.files in the root directory.
My project is configure so that only the "/private" directory is ignored by SVN.
How can I tell cscope to put its files in "/myproject/private" rather than "/myproject"?
According to the documentation there is no such setting (or at least I cannot find it). If SVN is what concerns you can just ignore the cscope files on their own.

EDE subproject confusion

I've been trying to get subprojects in EDE to work, but I don't understand much and I can't find any good documentation. What would the project configurations have to look like for the following tree:
Test
Project.el
bin
test
src
Project.el
main.cpp
class.cpp
inc
Project.el
class.h
To make a project like that, first create the toplevel project with:
M-x ede-new RET
and fill it in as an Automake or Makefile based project. (either is fine.) Then for each sub-directory, use ede-new again with the same project style. These projects will get linked together under the top-level project. You then use
M-x customize-project RET
to edit any features you need for the project. If you use dired, you can mark files and use the Project menu to add those files to some target, or create new targets to add them to. You don't need to know what is in the Project.ede files to do that. As it happens, the Project.ede file is just some Emacs Lisp code that creates the objects that represent the project you are working in.