I've defined a basic applet template, included below. Anyone know of a
neater way to get it into the jde-mode-abbrev-table. 

Also the indenting for closing braces doesn't seem to work, they are
always one indent to the right of where they should be. This is easy
to fix by reindenting the buffer after expanding the abbrev, but its a
bit annoying. 

(tempo-define-template 
 "applett"                           ;; template name 
 '("import java.applet.Applet;" n n
   "public class "(file-name-sans-extension (file-name-nondirectory buffer-file-name))
   " extends Applet " n
   "{" n n
  
   > "public void init (){" n>
   "//browsers sometimes call init more than once" n>
   "if (!doneInit){" n>
   "//init code here" n>
   "//parameter = getParameter(\"parameter\");" n> 
   p n>
   "doneInit = true;" n>
   "}" n>
   "}" n> n
  
   > "public void start(){" n>
   "}" n> n

   > "public void stop() {" n>
   "}" n> n

   > "public void destroy(){" n>
   "//cleanup code here" n>
   "doneInit = false;" n>
   "}" n> n
  
   > "public String getAppletInfo(){" n>
   "return (\""(file-name-sans-extension (file-name-nondirectory buffer-file-name))" 
Applet :  Copyright (C) "
    (substring (current-time-string) -4) " " 'user-full-name  " <" 'user-mail-address 
">" 
   "\");" n>
   "}" n> n
  
   "boolean doneInit=false;" n>
   "}" n> n
   ;;(mark-whole-buffer)
   ;;(indent-region)
   )

   "ap"                           ;; abbreviation 
   "Inserts an applet skeleton"  ;; template documentation 
   'jde-tempo-tags)

(define-abbrev-table 'templates-jde-mode-extra-abbrev-table 
  '(("applett" "" tempo-template-applett 0))
)

(derived-mode-merge-abbrev-tables
 templates-jde-mode-extra-abbrev-table
 jde-mode-abbrev-table) 

barney

Barney Dalton                                       
[EMAIL PROTECTED]
Twist my arm http://telerobot.mech.uwa.edu.au       

Reply via email to