Ole Arndt writes: > Hi Lars, > > Lars Degerstedt <[EMAIL PROTECTED]> writes: > > > I wonder if it is possible to express the fact that I have multiple > > sourcepaths using a regexp (since my enumeration varies). The > > expression > > I would like to handle is: > > > > */src/java > > > > or similar. I have not been able to find anything on this in the > > documents. Is this possible? > > It is not recommended by Paul, but you can edit your prj.el files by > hand and not use this awkward customization interface. You can then > use lisp code to set the project variables, like this: > > (jde-set-variables > '(jde-sourcepath (mapcar (lambda (path) > (expand-file-name "src/java" path)) > (directory-files))))
I think the directory-files function requires an argument that specifies a directory. This highlights the advantage of using the "awkward" customization interface; no programming errors. Also, I've never understood the big attraction of having to manually find and open a project file, edit it, and then save it, an error-prone and tedious process. Not my idea of a good time but, heck, to each his own. Of course, there's always the alternative of proposing a change to the JDEE to enhance the customization interface to support features that you need, e.g., providing the option to specify a function to compute jde-sourcepath or as in this case regular expressions. But I'm curious as to what kind of a project structure would make regular expressions in source paths useful. Where I work, all of our Java source files are in a directory named src (actually, of course, in subdirectories of the src directory corresponding to packages). I also set up my personal projects so that for each project, the source files are under a project named src. Thus, for me the typical "awkward" customization interface reads as follows: Jde Sourcepath: Hide INS DEL Path: ./src INS DEL Path: c:/java/jdk-1.5/src INS State: you have set this option, but not saved it for future sessions. This is all that's necessary for most projects that I deal with, including enhancing MATLAB. The nice thing about this is I let Emacs do my project file programming for me. I never have to worry about creating bugs in my project files by, for example, forgetting function arguments, omitting parentheses, or assigning a string to a variable that requires a list of strings. Finally, to handle a path specification like: */src/java the JDEE would have to cycle through every directory on your system, appending /src/java to it, testing whether such a directory exists, and then searching that directory for the source file? Seems like a pretty time-consuming operation that might make finding and opening source files a very slow process. Paul > > Just be sure to never save your project files with jde-save-project, > or you will lose your changes. > > I have written myself a small module for a related purpose: Read the > dependencies from a maven project.xml file and build the > jde-global-classpath from this information. My .prj.el files now typically > look like this: > > (setq pom (pom-read-pom)) > (jde-set-variables > '(jde-global-classpath (pom-get-classpath pom)) > '(jde-project-name (pom-get-project-id pom)) > '(jde-sourcepath (quote ("./src/java" "./src/test")))) > > I have, of course, also a prj.el file for all my default settings in > my top level source directory. > > Ole > -- > Ole Arndt http://www.sugarshark.com >