I have written this function to solve the problem...it isnt a pretty
solution but it should work.

;; *****

(defun my-jde-space ()
  (interactive)
  (let ((st (thing-at-point 'word)))
  (if (or
       (string= st "main")
       (string= st "if")
       (string= st "else")
       (string= st "eif")
       (string= st "ife")
       (string= st "while")
       (string= st "for")
       (string= st "fori")
       (string= st "foriter")
       (string= st "switch")
       (string= st "switch")
       (string= st "case")
       (string= st "try")
       (string= st "catch")
       (string= st "tryf")
       (string= st "finally"))
      (expand-abbrev)
      (insert " "))))

;;  ******

The only problem is now I dont know how to bind this to "SPC" in Jde-mode

/ Andreas Wieweg



----- Original Message -----
From: "Wellie W. Chao" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 14, 2002 3:17 AM
Subject: Auto-expansion of condition/flow blocks and spaces


> I like the auto-expansion of 'if', 'for', 'while', etc... blocks, but one
> thing I find annoying is the insertion of a space within the condition
test
> or loop definition. For example, I type 'if<space>' and JDE expands it to:
>
>   if ( ) {
>   }
>
> It places my cursor right on the right parenthesis on the first line.
> However, there is an extra space. The same thing happens with 'for' and
> 'while' blocks. I can't seem to get rid of that first space in the
> parenthesis. I think JDE is capturing the space I type and inserting it.
If
> I type 'if(' I get:
>
>   if (() {
>   }
>
> Note that there is no space after the first left parenthesis. My cursor
gets
> placed on the right parenthesis on the first line. Is there any way I can
> get JDE to not insert the space within the parenthesis? Alternatively,
maybe
> there is a way to have JDE send a backspace immediately after expanding
the
> block?
>
----- Original Message -----
From: "Wellie W. Chao" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 14, 2002 3:17 AM
Subject: Auto-expansion of condition/flow blocks and spaces


> I like the auto-expansion of 'if', 'for', 'while', etc... blocks, but one
> thing I find annoying is the insertion of a space within the condition
test
> or loop definition. For example, I type 'if<space>' and JDE expands it to:
>
>   if ( ) {
>   }
>
> It places my cursor right on the right parenthesis on the first line.
> However, there is an extra space. The same thing happens with 'for' and
> 'while' blocks. I can't seem to get rid of that first space in the
> parenthesis. I think JDE is capturing the space I type and inserting it.
If
> I type 'if(' I get:
>
>   if (() {
>   }
>
> Note that there is no space after the first left parenthesis. My cursor
gets
> placed on the right parenthesis on the first line. Is there any way I can
> get JDE to not insert the space within the parenthesis? Alternatively,
maybe
> there is a way to have JDE send a backspace immediately after expanding
the
> block?
>

Reply via email to