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

Reply via email to