How to set different source directories in cedet? - cedet

How do I specify different source directories under cedet ?
I have configured my project like this:
(when (file-exists-p "~/ws/madwifi/build/Makefile")
(setq cpp-tests-project
(ede-cpp-root-project "madwifi"
:file "~/ws/madwifi/build/Makefile"
:system-include-path '("~/ws/madwifi/build/include/drivers"
"~/ws/madwifi/build/include/hw/"
)
)))
But when I do a semantic-symref-symbol on a symbol, it sometimes lists only functions
that are used in the project. variables are not symref'd
But when I completely remove the block above, it shows the references of variables only
from the current directory. How to properly configure ede-cpp-root-project.

The symref tools only work within the current project, and do not pull data in from include paths. You can search for references to a symbol from an include file, but it won't find the declaration from the includes.
The symref tool works with several different external tools such as GNU Global or idutils. In theory you could use one of those tools to index whichever files you want, and as long as the index file is at the root of your project, it will find it, and also find your external includes. I haven't tried this though, so I don't know if these tools have that capability.
If you want to jump to a reference in an external include, you can use other tools, like semantic-ia-fast-jump and that uses include paths instead of project indicies, but it won't find references.

Related

How to import files relative to main file, instead of current directory? ((Chez) Scheme)

For example, in my main.scm file I have (load "util.scm"). util.scm is a file in the same folder as main.scm. Both files are located in ~/documents/myproject/.
Now when I'm in this directory, and I run $ chez-scheme main.scm everything works fine. However, if I'm in my home directory and run $chez-scheme documents/myproject/main.scm it complains, not being able to find the file util.scm. I suppose this is the case because the current directory was my relevant home directory, and as such util.scm is indeed not there, it is actually in documents/myproject/. That being said, I'm used (in other languages) to the functionality of looking these paths up relative to the file containing the instruction to import, and I'd like to have that here as well. I've tried prefixing it by ./ or defining the file as a libary and doing (import (util)) but none of it works outside of documents/myproject/. Is there any way to get this to work as I intend it to?
I assume this is Chez-Scheme-specific. If not I'd prefer an answer that is implementation-neutral.
load is kind of awkward in R5RS since the report states that system interfaces are off topic in the report, but they include load which is a half hearted solution. The report does not say if the load is relative to the current directory or the file the load form originates from so in order to be portable I guess you are required to run your script from the current directory and have your loaded file relative to both.
Since Chez Scheme implements R6RS load is not really the right form to use. R6RS removed load in favor of libraries. You should make your file a library and consult how to install it. In some systems that is just placing the files in the right path, adding library location in configuration or running install script. How one uses the library is the same in all implementations, by using import.
According to Chez documentation you can pass --libdirs to it to give it one or more paths to consider for loading libraries. You can see the paths it scans by evaluating (library-directories)
There are several different ways to accomplish what (I think) you are trying to do, but eventually they all boil down to letting Chez know where to look for things. When given relative paths, include and load use the source-directories parameter to search for the requested file. Libraries have their path automatically prepended to source-directories while they are being loaded or compiled, so if your main.scm were a library definition then it would find util.scm as you expect.
However, it sounds like main.scm isn't a library, it's a top-level program. Unfortunately, Chez doesn't have a command line option to set the source-directories like it does for library directories. That leaves you with a bit less flexibility. Any of the following will work:
Make util.scm a library and invoke Chez with the --libdirs option to let it know where to look for libraries.
Set source-directories and load main.scm from inside the REPL rather than from the command line.
Write a wrapper shell script that does the above by echoing the commands into scheme so you don't have to type it yourself. (Only suitable if you don't also need to then type into the scheme session).
Write a wrapper shell script that cds into your project directory before running scheme (and presumably cds back to the original directory when it's done).

Generating a global include graph in Doxygen

Doxygen can generate graphs showing which files in a project include which others, as a directed graph. This is a nice tool, but it only comes in two flavors, namely showing all the files that include (directly or indirectly) a given file, or all the files that are included (again directly or indirectly) by a given file.
I would like to generate a global include graph, containing all the files that Doxygen knows about, and showing the include structure. Is that possible?
One trick that kind of works but feels extremely dirty: add some dummy.h header somewhere, and include it from every other file, or alternatively (a bit cleaner since it doesn't need to touch the other files) have dummy.h manually include everything else. And then manually remove useless includes (which are implied by others as indirect dependencies). That is not the right way to do it...

Aquamacs 2.4 -- subdirs.el -- How to exclude a path from loading

I am setting up Aquamacs 2.4 to be used on at least three different computers and I'm uncertain how best to go about excluding a path (e.g., /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/tabbar) from subdirs.el located within /Applications/Aquamacs.app/Contents/Resources:
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(normal-top-level-add-subdirs-to-load-path))
And, another subdirs.el located within /Applications/Aquamacs.app/Contents/Resources/lisp:
;; In load-path, after this directory should comecertain of its subdirectories. Here we specify them.
(normal-top-level-add-to-load-path '("url" "textmodes" "progmodes" "play" "org" "nxml" "net" "mh-e" "mail" "language" "international" "gnus" "eshell" "erc" "emulation" "emacs-lisp" "contrib" "cedet" "calendar" "calc" "aquamacs" "obsolete"))
I spent several hours trouble-shooting and ultimately customizing aquamacs-tabbar.el within /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/tabbar. After finally figuring out what was happening, I had two obvious choices -- (1) hard-code aquamacs-tabbar.el by striking out the relevant portions that were overriding customizations.el; or, (2) hard-code all of my customizations directly into aquamacs-tabbar.el. So now I have a hard-coded customized aquamacs-tabbar.el (hidden within the application package) -- I'd like to copy it over to a more user-friendly script loading directory /Users/HOME/Library/Preferences/Aquamacs Emacs so that I can use it there, and also synchronize that directory and all sub-directories with my other three computers.
I'd like to leave as much of the application intact as possible, but I really don't want to be synchronizing the application itself to multiple computers on an ongoing basis.
Maybe the solution is to just strip the guts out of Aquamacs 2.4, and synchronize the skeleton to all of my computers, and then place the stripped guts within /Users/HOME/Library/Preferences/Aquamacs Emacs. Then I can synchronize the latter with my other computers to my hearts content.
I'm sure that customizing aquamacs-tabbar.el is just the first of many scripts (hidden within the application package) that will need to be tweaked.
Any ideas would be greatly appreciated.
For ideas regarding how to customize the paths for all emacs-related files during the build process (to have everything under the same roof), please refer to:
OSX -- configuring Emacs to use NSSpellChecker

Emacs and cscope with multiple directories

How do I set up cscope in Emacs when my source code lives in multiple directories?
Say I have several paths for my C++ project:
/path/to/my/code (and subdirectories)
/path/to/other/code (and subdirectories)
/path/to/static/linking/include/files (and subdirectories)
/path/to/static/linking/lib/files' (and subdirectories)
I would like to use xcscope to navigate/look up symbols in my code and the library that I am linking to.
The instructions for xcscope.el say that I should first run C-c s (Cscope->Create list and index) at /path/to/my/code, but I am then confused about how I to have the other paths indexed by cscope.
The documentation says I should go to the other directories and run cscope -b, but what I am supposed to do after that?
I looked at the cscope.files file that C-c s built. I think I am supposed to add my other paths to this file, but this file includes a list of source code files (not directories).
Do I have to manually edit cscope.files to add every single file that I want to index that is outside of my project's root directory?
The documentation is confusing.
I got one sol'n from http://cscope.sourceforge.net/large_projects.html. Still confusing.
cscope.files is aptly named. It is NOT directories. It is files, only files. Which is as daunting as it sounds. What if you have hundreds of files. Then you have to write hundreds of lines, one per file, into cscope.files. No joke.
Automate it with some scripting. E.g., on linux, use bash scripts and redirection (>,>>,|) operators to select and filter files from any and all directories into that cscope.files.
What about the directory where cscope.files resides? IF you don't include those files, it'll only find them when you open your project (in emacs, but probably applicable to any IDE) in that source directory. So, include them, too, for easy opening of your project from anywhere.
The option "recursive/-R" seems obvious to send to cscope-indexer. Nope, not with many root directories. Does nothing (probably could do something with scripts or elisp or who knows). Just feed those files, absolute path, into cscope.files. And you might have to make sure you have only one cscope.files per project. Don't split them up relative to each diretory. Or maybe you can, something to look into.
Remember, include the /path/to/each/file/ before the file if you want cscope.files to point to it from anywhere. cscope isn't "smart", it's dumb, it just takes directions for where to look and it won't know where to look for "filename", without knowing where it is. You're just asking it to call locate filename, which it can't do anyway, when you give it a lonely filename without a dir path outside of the directory that a particular cscope.files resides.
I hope there's a way to use xcscope inside emacs, just adding directories which it will catalog and index, as the xcscope docs and emacs menu suggest. But I didn't succeed in making it work that way.
Wouldn't a soft link (ln -s) work? Worked for me.

It is normal to place Emacs plugins in different directories?

I've placed 2 plugins in different directories (according to their docs instructions).
One is in C:\Documents and Settings\Alex.AUTOINSTALL.001\Application Data\.emacs.d
(the plugin is yasnippet-0.6.1c).
I placed the second in D:\Program Files\emacs-23.1\site-lisp (the plugin is color-theme).
I think its a bit confusing to place plugins in different directories. It is possible to place them in only one directory? or because of the 'nature' of those plugins they must be placed in those separated directories?
You may put your elisp files wherever it's convenient for you, as long as the directories you use for this purpose are on your load-path. For example, I have this line in my ~/.emacs file:
(add-to-list 'load-path "~/.emacs.d/autoload")
And most of my extra elisp resides there. (I've also got separate directories for larger apps.)
On Windows, you'll be putting something similar in your _emacs file.
Similar to Michal, I suggest having a folder, next to your .emacs file (wherever that is) and in there, you can have sub-folders for whatever local elisp you need. I use a folder called ~/elithp (I thought it was funny 17 years ago when I started it B-)
Also, things will often want to be put in /usr/local/share/emacs/site-lisp or some equivalent, if they are not user specific.
I'm not exactly sure what the Windows equivalent locations are...