Hi,

in current JDE there are a lot of options where we can define path-lists, e.g.
jde-db-source-directories, jde-global-classpath etc. Some of them uses expansion
of environment-variables some of them not (AFAIK).

Here comes a design-suggestion for the JDE-implementation:

Every(!) option which can store pathes should be able to substitute env-vars.

This can easily be done be something like:

(defmacro jde-expand-path-list (pathlist)
  "Expands all pathes of the list PATHLIST and returns a list with the
expanded pathes."
  (` (mapcar (lambda (path)
               (expand-file-name (substitute-in-file-name path)))
             (, pathlist))))

With this macro each of these options should have a :set-clause in it's defcustom-
definition, e.g.

(defvar jde-global-class-path-internal nil)
(defcustom jde-global-class-path nil
  "..."
  :group 'jde-project
  :type '(repeat (file :tag "Path"))
  :set (function (lambda (sym val)
                         (set sym val)
                         (setq jde-global-classpath-internal (jde-expand-path-list 
val)))))

For each path option jde-XXX in JDE there should be an internal var jde-XXX-internal
which is set by the .set-clause of jde-XXX and contains always the full expanded pathes
Every code in JDE uses always and only jde-XXX-internal.

Advantages: 
- Clear design of all path-options in JDE
- Only one call for expanding (in the :set-clause)

Only drawback: Changes of an env-var does not take effect until the path-option is set
again by the user (either by reloading JDE or hitting "Set for current session" in the 
customize-
buffer).

Any thoughts?

Klaus

-- 
Klaus Berndl                    mailto: [EMAIL PROTECTED]
sd&m AG                 http://www.sdm.de
software design & management    
Thomas-Dehler-Str. 27, 81737 M�nchen, Germany
Tel +49 89 63812-392, Fax -220

Reply via email to