I used to be annoyed by the same thing.
Reworking the templates as below has made them more useful for me.
It ought to be fairly easy to remove the (in)appropriate
occurrences of  'n' if you someone should want the braces placed differently.

Regards,

Per

(jde-set-variables
  '(jde-gen-cflow-if
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"if\")" "'(l > \"if (\"
(p \"if-clause: \" )\") \" n" "\"{\" > n> r n " "\"} \" >)" ")")))
   '(jde-gen-cflow-else
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"else\")" "'(l > \"else
\" n" "\"{\" > n> r n" "\"}\" > >)" ")")))
   '(jde-gen-cflow-while
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"while\")" "'(l > \"while
(\" (p \"while-clause: \" )\") \" n" "\"{\" > n> r n " "\"} \" >)" ")")))
   '(jde-gen-cflow-for
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"for\")" "'(l > \"for (\"
(p \"for-clause: \" )\") \" n" "\"{\" > n> r n " "\"} \" >)" ")")))
   '(jde-gen-cflow-for-i
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"fori\")" "'(l > \"for
(int \" (p \"variable: \" var) \" = 0; \"" "(s var)" "\" < \"(p \"upper bound: \"
ub)\"; \" (s var) \"++) \" n" "\"{\" > n> r n" "\"} \" >)" ")")))
   '(jde-gen-cflow-switch
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"switch\")" "'(l >
\"switch (\" (p \"switch-condition: \" )\") \" n" "\"{\" > n" "\"case \" (p
\"first value: \") \":\" > n> p n" "\"break;\" > n> p " "\"default:\" > n> p "
"\"break;\" > n" "\"} \" >)" ")")))
   '(jde-gen-cflow-case
     (quote ("(if (jde-parse-comment-or-quoted-p)" "'(l \"case\")" "'(l \"case \"
(p \"value: \") \":\" > n> p n" "\"break;\" > p)" ")"))))

(tempo-define-template
 "plr-tc"
 (quote
  ("try" > n
   "{" > n
   > p n
   "}" > n
   > "catch(" (p "Exception: ") ")" > n
   "{" > n
   > p n
   "}" > p))
 nil
 "Insert a Java try/catch skeleton")

(tempo-define-template
 "plr-tcf"
 (quote
  ("try" > n
   "{" > n
   > p > n
   "}" > n
   > "catch(" (p "Exception: ") ")" > n
   "{" > n
   > p n
   "}" > n
   "finally" > n
   "{" > n
   > p n
   "}" > p
   ))
 nil
 "Insert a Java try/catch/finally skeleton")

(define-abbrev global-abbrev-table "tc" "" 'tempo-template-plr-tc 0)
(define-abbrev global-abbrev-table "tcf" "" 'tempo-template-plr-tcf 0)


Yaroslav Bulatov wrote:

> Actually the problem is more complicated. The space that I'm encountering
> is the space that I press that forces the execution of the template. So I
> get something like this `if ( a==0)' if I type `if a==0'... Same situation
> exists for abbreviations. For instance my "pr" abbreviation linked to
> `System.out.println("' actually produces System.out.println(" test") if I
> type `pr test' (instead of System.out.println("test")) I haven't figured
> out the solution to the problem, and if somebody knows Lisp enough to tell
> me how to undo the space that triggers expansion in cflow templates and/or
> in abbreviations, I'll appreciate it.
>
> Yaroslav
>
> On Fri, 25 Aug 2000, Brad Giaccio wrote:
>
> > Try doing M-x customize  jde-gen
> > then edit the variables for clfow-if  and any others then hit save.
> >
> > Brad
> >
> > On Fri, Aug 18, 2000 at 06:17:20PM -0700, Yaroslav Bulatov wrote:
> > > Here's my problem
> > > I need to take out extra inside padding on parenthesis in control flow
> > > templates. (so instead of "if (  )" I want "if ()")  I looked at code for
> > > templates, but since I'm not knowledgeable
> > > in lisp, it doesn't make sense to me how to take off the extra spaces. I'd
> > > appreciate if someone could show me how to take out extra spaces in
> > > following template -->
> > >
> > >  (if (jde-parse-comment-or-quoted-p)
> > > '(l "if")
> > > '(l '> "if (" (p "if-clause: " clause) ") "
> > > (if jde-gen-k&r
> > > ()
> > > '>'n)
> > > "{"'>'n'>'r'n
> > > "} // end of if (" (s clause) ")"'>'n'>)
> > > )
> > >
> > > Yaroslav
> >
> > --
> > --- There are two kinds of knowledge, you either know the answer or
> >                       you know where to find it
> >                     -Kane, Johnson, and anonymous
> >

Reply via email to