>>>>> "Glen" == Glen Cordrey <[EMAIL PROTECTED]> writes:
Glen> Does anyone know of a way to disable the insertion of
Glen> templates within comments? For example, if I have a 'for'
Glen> template and type in a java file
Glen> /** This is for
Glen> the template gets inserted when I type in the comment, which
Glen> is obviously not what I want.
If you are using jde-cflow to insert the templates there is
not a trivial way to do this. jde-cflow uses abbreviation mode to
trigger the insertion of templates. Switching on abbrev mode affects
the entire buffer. The same is true for the JDE mode abbreviation
expansion.
There are a couple of possible solutions to the problem.
The one which I use is to re-define the abbreviations to
things which are not words. I've done this for both the jde-cflow, and
jde abbreviations. So I use "foi" to get an incrementing for loop,
"fod" to get a decrementing one, "ret" instead of the standard "re"
for "return. If you want to try this I suggest that you try the
updated version of jde-cflow that I wrote which allows you to use
customize to change the templates, and abbreviations (available at
genetics.ich.ucl.ac.uk/plord).
Second would be to switch abbrev mode off, and use C-x a e
(expand-abbrev) to manually expand the abbreviation before the point.
Finally if you are into lisp there is a hook,
pre-abbrev-expand-hook which you could use to check to see if you were
within a comment (using the syntax information available from C mode)
to abort the expansion, by throwing an error I guess.
Its an interesting point here. It would be nice to be able to
switch on and off minor modes depending on the syntax info. For
instance I would like to switch auto-fill mode on within comments and
off everywhere else. It would also be useful for doing things like
SQLJ, so that you could enable SQL specific functions when within the
embedded SQL. If anyone has any idea's how to do this Id love to
hear.