At 02:01 PM 2/13/2001 +0100, [EMAIL PROTECTED] wrote:
>In general i find the project switching mechanism and related setting of all 
>jde-options to the
>values of the new project file or - if there is no project file - resetting 
>the values to the ones set in
>.emacs or - if there are no new values set - to the JDE default values. 
>Really tricky and nice.
>
>But there are situations, where this is very annoying. I´m writing an 
>extension to JDE which can
>open always the java-file where the current thing at point is defined.
>For the opening function of this new feature i have written a new jde-option:
>
>(defcustom jde-open-class-at-point-find-file-function 'find-file-other-window
>  "Define the function for opening the class at point. See
>`jde-open-class-at-point'`. Default is `find-file-other-window'. A function
>defined here must have the same signature as `find-file' means the first
>argument is the filename and the second optional argument is a
>wildcard-pattern."
>  :group 'jde-project
>  :type '(function :tag "Function to open class at point"))
>
>This is useful because maybe a user want to define the behavior how the 
>java-file is opened (
>in another window or the same window for example).
>
>But also some other Tools like JCB (java class browser) want to change the 
>value
>of this new option for the time they are active, because they need an own 
>special "xyc-find-file"
>function used with the new openeing feature because the tool uses a special 
>window layout for
>example.
>
>Now comes the problem: How should such a tool set an own value for
>'jde-open-class-at-point-find-file-function (see above) with setq if after 
>each buffer-switch to another
>jde-buffer the default or customized value is reset????? IMHO 
>'custom-set-variables from within
>elisp-code should not be used to change temporaly the value of an option!
>
>IMHO JDE should offer an mechanism to exclude certain options from the 
>automatic reset after each
>buffer switch, maybe with an new option 'jde-no-project-related-options 
>where we can define all jde-options
>which should be excluded.
>
>IMHO such options like the one i have defined new (see above) are never 
>project related, regardless of the project
>a user will always use the same value!!!!
>
>Setting 'jde-project-context-switching-enabled-p to nil is IMHO not an 
>alternative because this disables the whole
>mechanism for every jde-option, and like said at beginning, in genral this 
>feature is nice, but not always and not
>for EVERY option!
>

Hi Klaus,

The project-switching feature affects only variables defined by defcustom.
It does not affect variables defined by defvar. So, one approach to solving
your problem would be to define two variables:

(defcustom jde-x ...)
(defvar jde-x-override ...)

Your code would use the value of jde-x-override, if it is non-nil;
otherwise, your code would use the value of jde-x. Other packages could
then use jde-x-override to temporarily override the customized value of
jde-x. This would give you the best of both worlds, the ability to
customize jde-x on a project-by-project basis and the ability for other
packages to override the value temporarily.

- Paul

Reply via email to