RE: New for loop template...

2001-06-08 Thread Javier Lopez

Read the section on creating templates in the JDE user's guide.
It explains how to create new templates and register them.
You can read the jde user manual locally in your machine
by going to JDE-Help - JDE User's Guide. Or go online
to http://sunsite.auc.dk/jde/ there is a link here to the user's guide
as well.

Javier

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, June 07, 2001 6:17 PM
 To: Robert Mecklenburg
 Cc: JDE Users
 Subject: Re: New for loop template...


 Is there a generic way for users to add new templates to jde-mode without
 editing jdel lisp files?  i.e. some way to use customize to create a new
 template, add it to the abbrev table for jde-mode and save this
 customiozation in your .emacs file?  If this can't be done, is
 there a way
 for me to customize the abbrev table for jde-mode manually within my
 .emacs file?  If there is no way to do it with customize, that might be a
 worthy feature to add.  Thanks,

 Matt

 On 06/07/2001 05:59:50 PM Robert Mecklenburg wrote:
 
  Here is a new template I'm using which seems generally useful.  It
  builds a for loop with an iterator and it bound to foriter:
 





New for loop template...

2001-06-07 Thread Robert Mecklenburg

Here is a new template I'm using which seems generally useful.  It
builds a for loop with an iterator and it bound to foriter:

for (Iterator var = coll.iterator(); variter.hasNext();)
{
  var.next();
} // end of for (Iterator iter = dups.iterator(); iter.hasNext();)

The template prompts for var and coll.  I hope you find it useful
enough to include in jde.  If you'd prefer the submission in another
format (such as a compile jde-gen.el file, I'm happy to do that.


(defcustom jde-gen-cflow-for-iter
  '(
(if (jde-parse-comment-or-quoted-p)
'(l \foriter\)
'(l ' \for (Iterator \ (p \variable: \ var) \ = \
(p \collection: \ coll) \.iterator(); \
(s var) \.hasNext();\
\)\
(if jde-gen-kr 
()
''n)
\{\''n''r'n
(s var) \.next();\ ''n'
\} // end of for (Iterator \ (s var) \ = \ (s coll) \.iterator(); \
(s var) \.hasNext();)\''n')
)
  )
  Skeleton for iterator statement. To insert the statement at point,
type foriter and then space.  Note that abbrev mode must be
enabled.  See `jde-enable-abbrev-mode' for more information.
  :group 'jde-gen
  :type '(repeat string)
  :set '(lambda (sym val)
  (tempo-define-template
 jde-for-iter
 (jde-gen-read-template val)
 foriter
 Insert a Java for iterator statement
 'jde-tempo-tags)
  (set-default sym val)))

(defun jde-gen-load-cflow-abbrevs ()
  Defines jde-mode abbrevs for the control flow templates.
  (define-abbrev local-abbrev-table if  'tempo-template-jde-if 0)
  (define-abbrev local-abbrev-table else  'tempo-template-jde-else 0)
  (define-abbrev local-abbrev-table ife  'tempo-template-jde-if-else 0)
  (define-abbrev local-abbrev-table while  'tempo-template-jde-while 0)
  (define-abbrev local-abbrev-table for  'tempo-template-jde-for 0)
  (define-abbrev local-abbrev-table fori  'tempo-template-jde-for-i 0)
  (define-abbrev local-abbrev-table foriter  'tempo-template-jde-for-iter 0)
  (define-abbrev local-abbrev-table switch  'tempo-template-jde-switch 0)
  (define-abbrev local-abbrev-table case  'tempo-template-jde-case 0)
  (define-abbrev local-abbrev-table try  'tempo-template-jde-try-catch 0)
  (define-abbrev local-abbrev-table catch  'tempo-template-jde-catch 0)
  (define-abbrev local-abbrev-table tryf  'tempo-template-jde-try-finally 0)
  (define-abbrev local-abbrev-table finally  'tempo-template-jde-finally 0)
  (define-abbrev local-abbrev-table main  'tempo-template-jde-main 0))


Cheers,
-- 
Robert




Re: New for loop template...

2001-06-07 Thread Matt_Conway

Is there a generic way for users to add new templates to jde-mode without 
editing jdel lisp files?  i.e. some way to use customize to create a new 
template, add it to the abbrev table for jde-mode and save this 
customiozation in your .emacs file?  If this can't be done, is there a way 
for me to customize the abbrev table for jde-mode manually within my 
.emacs file?  If there is no way to do it with customize, that might be a 
worthy feature to add.  Thanks,

Matt

On 06/07/2001 05:59:50 PM Robert Mecklenburg wrote:
 
 Here is a new template I'm using which seems generally useful.  It
 builds a for loop with an iterator and it bound to foriter: