>Your right to do ssuch an enhancement for JDE paul,
>the default directory to place the project is often a problem
>when creating relatively big projects...
>I don't if many other users would agree but i think it would
>be a nice idea to place the project in the first package-directory
:
What Paul is saying is that when you first save the project you get
to choose where to save the project file (ie: the JDE prompts you for
the filename).
Paul might be interested in the attached code. It does exactly what
he's suggested and I've been using it as part of my project system for
a while now.
Nic
;;save jde project variables in a buffer and save the buffer
;;
(defun jde-compile-plus-save-variables (project-buffer)
"Save all JDE variables in the specified buffer."
(save-excursion
(let ((standard-output project-buffer))
(set-buffer project-buffer)
(erase-buffer)
(princ "(jde-set-project-name ")
(prin1 jde-project-name)
(princ ")\n")
(princ "(jde-set-variables ")
(mapcar
(lambda (symbol)
(when (and (string-match "jde-" (symbol-name symbol))
(get symbol 'custom-type))
(let ((value (symbol-value symbol)))
(princ "\n '(")
(princ symbol)
(princ " ")
(prin1 (custom-quote value))
;;flag any customized variable
(if (get symbol 'customized-value)
(princ " t)")
(princ ")"))
)))
(jde-symbol-list))
(princ ")")
(save-buffer)))
(kill-buffer project-buffer))
;;causes a filename to be read from the mini-buffer (with
completion)
;;The filename is then used to save the project variables in
;;;###autoload
(defun jde-compile-plus-save-project (proj-name)
"Saves local source file buffer options in project file.
This command provides an easy way to create and update a
project file for a Java project. Simply open a source file,
set the desired options, using the JDE Options menu, then
save the settings in the project file, using this command.
Now, whenever you open a source file from the same directory
tree, the saved settings will be restored for that file."
(interactive
(list
;;we have to save insert-default-directory coz we're gonna set it
to true
(let* ((initial-default-directory nil)
(prompt "Enter project name: ")
(current-prj-fname (jde-find-project-file
default-directory))
(prj-fname
(if current-prj-fname
(file-truename current-prj-fname)
(if (string= jde-project-file-name "")
(if (string= jde-project-name "default")
"prj.el"
jde-project-name)
jde-project-file-name)))
(dir (file-name-directory prj-fname)))
(setq initial-default-directory nil)
(if dir
(read-file-name prompt "" nil nil prj-fname)
(let ((initial-default-directory 't)
(filename (file-name-nondirectory prj-fname)))
(read-file-name prompt default-directory nil nil
filename))))))
(unless (string= proj-name "")
(setq jde-project-name (file-name-nondirectory proj-name)))
(find-file-noselect proj-name)
(jde-compile-plus-save-variables (get-file-buffer proj-name))
)