Re: Regexp on sourcepath possible?

2005-03-28 Thread Paul Kinnucan
Jason Baker writes:
 > Paul Kinnucan <[EMAIL PROTECTED]> writes:
 > 
 > > 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.
 > 
 > I'm using JDE in a system that is built using autoconf and make.  The
 > canonical way to invoke javac is by running make, so the makefile in
 > the main java directory contains a rule to generate the prj.el file.
 > For me, this is a lot easier than going through the "awkward"
 > customization interface each time I set up a new working tree.

On the other hand, I use David Ponce's JMaker to generate the makefiles for my
projects from the JDEE's customization variables (i.e., the prj.el file). No
handwritten code involved at all.

Paul



Re: Regexp on sourcepath possible?

2005-03-28 Thread Jason Baker
Paul Kinnucan <[EMAIL PROTECTED]> writes:

> 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.

I'm using JDE in a system that is built using autoconf and make.  The
canonical way to invoke javac is by running make, so the makefile in
the main java directory contains a rule to generate the prj.el file.
For me, this is a lot easier than going through the "awkward"
customization interface each time I set up a new working tree.

Jason


Re: Regexp on sourcepath possible?

2005-03-21 Thread Troy Daniels
At 12:58 AM 3/15/2005, Paul Kinnucan wrote:
Ole Arndt writes:
 > Hi Lars,
 >
 > Lars Degerstedt <[EMAIL PROTECTED]> writes:
 >
 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.
Why do we use JDEE at all instead of just using the customize interface to 
make emacs perform like we want to?  Because there's no option that turns 
on all the functionality we want.  I generally edit prj.el by using the 
customize interface, but I'll sometimes edit prj.el directly.  There's a 
few cases where I do this, which probably indicates my wish list of prj.el 
enhancements.

I'm copying a prj.el file to a new but related project.  I want most of the 
settings to be the same, but there's some points where the project name is 
hard-coded.  M-x replace-string is actually better than 
jde-customize-variable, because I know I won't skip a variable.

 I want to run the program with a different set of arguments, but be able 
to swap back to the old arguments.  Generally, this involves changing the 
arguments passed to junit.textui.TestRunner from .SmokeTestSuite 
to .NightlyTestSuite.  I copy the old value to a comment, and then 
(usually) uncomment the value from the last time I did this.

I want to turn on profiling or remote debugging, so I want to 
comment/uncomment a fairly complex set of arguments and not have to 
remember how I set them.

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.
This is the better long-term solution, assuming somebody has the time and 
knowledge to implement the solution.

Troy

Troy Daniels
[EMAIL PROTECTED]
781-273-3388 x218


Re: Regexp on sourcepath possible?

2005-03-21 Thread Troy Daniels
At 12:58 AM 3/15/2005, Paul Kinnucan wrote:
Ole Arndt writes:
 > Hi Lars,
 >
But I'm curious as to what kind of a project structure would
make regular expressions in source paths useful.
The structure that I have at work is one such.  We have multiple 
subprojects side by side:

source
  project1
prj.el
com/foo/project1
  *.java
  project2
prj.el
com/foo/project2
  *.java
  ...
  project17
 prj.el
 com/foo/project17
   *.java
products
  
Some projects depend on others, but the dependency graph is non-cyclic, so 
we build and test project 1, then project 2 and so on.  Each prj.el sets 
jde-sourcepath to "." and jde-global-classpath to include 
../products//.  Which works, except 
when I try to jump to a source file in a different subproject.  What I'd 
like to do is set jde-sourcepath to ("." "../*") but instead, I have to 
manually do ("." "../project1" "../project2" ... "../projectN-1").  Which 
eventually gets built up in each prj.el.  And we frequently add more 
projects, so even if the list is complete, that's only a temporary condition.

Whether this is a good coding practice is debatable, but it is what we do.
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.
I'd be happy with just something that expands * like a unix wildcard.  So 
*/src/java woudn't be the equivalent of a unix find command, but more like 
the equivalent of ls */src/java.

Troy
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
 >

Troy Daniels
[EMAIL PROTECTED]
781-273-3388 x218


Re: Regexp on sourcepath possible?

2005-03-19 Thread Martin Schwamberger
Ole Arndt wrote:
I just find it sometimes more convenient to do:
(find-file (jed-find-project-file ".")), edit, save, 
(jde-load-project-file)' 

especially if you have bound these commands to keys already,
than to call:
customize-variable jde-..., where is the mouse again, click, click, 
click, ^C^V^S.

Hi Ole,
Custom mode does not require any mouse clicks to get the job done.
If you use jde-customize-variable, you don't even need the final ^C^V^P.
This command is able to save your changes directly
in the JDEE Project File.
That is an thing I missed several times, the possiblity to specify 
a function to compute the customization value on the fly, depending 
on context. But there are also cases where you want to execute 
arbitrary lisp code in the project files.
Consider my example:


> (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"

The function pom-read-pom does some rather expensive xml-parsing and
property file reading. You dont wan't to do it more often than necessary.
So I save it in a variable and pass that to the other functions. 
I have no idea how to do this with the customization interface.
Currently, the JDEE preserves additional code in the project file, 
but puts it at the end of the file. Can't we just insert 
jde-set-variables as the last command? That would make this kind of 
setup code work together with jde-save-project-file.

Hooks may help.
You can use jde-project-hooks for project initialization
and jde-mode-hook for buffer local initialization.
Example:
(jde-customize-variable (quote jde-project-hooks))
Insert:
(lambda ()
  (let ((pom (pom-read-pom)))
(setq jde-global-classpath (pom-get-classpath pom))
(setq jde-project-name (pom-get-project-id pom
Cheers,
Martin


Re: Regexp on sourcepath possible?

2005-03-15 Thread Ole Arndt
Hi Paul,

Paul Kinnucan  mathworks.com> writes:

> Ole Arndt writes:
>  > (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. 

Your are right, directory-files requires an argument. "." will do.
Please understand that I perfectly agree with the advantages you name
for using the customization interface. I could name a few more, i.e. 
you get an overview of all variables you can change, along with 
nice explanations in the doc strings. But sometimes it just isn't 
good enough. And then I resort to some lisp programming.

> 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. 

I just find it sometimes more convenient to do:

(find-file (jed-find-project-file ".")), edit, save, 
(jde-load-project-file)' 

especially if you have bound these commands to keys already,
than to call:

customize-variable jde-..., where is the mouse again, click, click, 
click, ^C^V^S.

> Not my idea of a good time but, heck, to each his own.

You say it :-)

> 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.

That is an thing I missed several times, the possiblity to specify 
a function to compute the customization value on the fly, depending 
on context. But there are also cases where you want to execute 
arbitrary lisp code in the project files.
Consider my example:

>  > (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"

The function pom-read-pom does some rather expensive xml-parsing and
property file reading. You dont wan't to do it more often than necessary.
So I save it in a variable and pass that to the other functions. 
I have no idea how to do this with the customization interface.
Currently, the JDEE preserves additional code in the project file, 
but puts it at the end of the file. Can't we just insert 
jde-set-variables as the last command? That would make this kind of 
setup code work together with jde-save-project-file.

> But I'm curious as to what kind of a project structure would
> make regular expressions in source paths useful. 

In our case the structure of the sources is dictated by the use of
two tools: maven and Eclipse. The gros of the development team is
using eclipse and needs to have all projects in a single 'workspace'
directory. Our nightly build works with maven, which has a project.xml
file for each project, describing the project and its dependencies.
The structure looks like this:

workspace/
  prj.el  (defaults)
  project1/
project.xml
prj.el (read classpath from project.xml)
src/
  java/
  test/
target
  classes
  test-classes
  ...
  project56/
...

where every project can depend on the jars generated by other projects.

Ole






Re: Regexp on sourcepath possible?

2005-03-15 Thread Lars Degerstedt
But I'm curious as to what kind of a project structure would
make regular expressions in source paths useful. 
Well, perhaps it is not. My problem is that I have ceveral projects that 
I want to keep separate, but also be able to collect them in one place 
and compile them all. The reason is that they have two kinds of 
developers: one like me that are engaged in all/most of them and one 
type that only looks at a particular project.

One way would be to merge the src-trees, but I thought (for CVS-reasons 
mainly) that it would be better to keep the src-trees as they look in 
when distributed separately.

I can do this with my ant-script, so it works fine on the "build-level". 
And also generate jar-archives etc.

But then I thougth that it would be nice to have a common prj.el for the 
"all-projects-developer" so that you can work in paralell on many 
projects, such as if they were one.

I agree with you that it is perhaps not the most effecient way to do it 
by kleene-star...but in my case I don't think it matters so much. 
Typical number of present projects during development is max 5-7 I would 
think.

Thanks for the respons.
Lars




Re: Regexp on sourcepath possible?

2005-03-14 Thread Paul Kinnucan
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
 > 



Re: Regexp on sourcepath possible?

2005-03-14 Thread Suraj Acharya
I'd posted some code to allow wildcards in jde-global-classpath and
jde-sourcepath to the list some time 
http://article.gmane.org/gmane.emacs.jdee/3863/match=wildcards

I have a page on the emacs wiki with the same code, with minor updates so
that it works on the latest jde release.

http://www.emacswiki.org/cgi-bin/wiki/SurajAcharya#WildcardsInPaths

Suraj

On Tue, 15 Mar 2005 00:25:10 +0100, Ole Arndt <[EMAIL PROTECTED]> wrote:
> 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
> 
> 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
> 
>


Re: Regexp on sourcepath possible?

2005-03-14 Thread Ole Arndt
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

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



Regexp on sourcepath possible?

2005-03-14 Thread Lars Degerstedt
Hi,
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?

All help on this is appreciated!
Thanks,
Lars