Chitale, Sandip V writes:
 > 
 > Marcel,
 > 
 > I think I have a solution for your issue:
 > 
 > <ISSUE>
 > I've got a problem with jde's if-template. F.e. I want to write
 > 
 > if (a == b) {
 > 
 > }
 > 
 > However, when I type `i' - `f' - <SPACE>, this here happens:
 > 
 > if ( [cursor]) {
 > 
 > }
 > 
 > As you can see, there's a space before the cursor. This space does not
 > appear because of one of these 3 conditional spaces but because of me
 > having typed the <space> key. What do I have to change in order to get
 > after typing `i' - `f' - <SPACE> this here:
 > 
 > if ([cursor]) {
 > 
 > }
 > 
 > that is there's no space before the cursor.
 > </ISSUE>


Hi Sandip,

I cannot reproduce this problem on my system (Windows Millenium,
Emacs 21.3.1, JDEE 2.3.3beta5), i.e., when I type

if 
   ^

Emacs responds


if (
    ^

and prompts me to enter the if-clause in the minibuffer. If I enter
a==b in the minibuffer, Emacs completes the above expression as


  if (a==b) {
     
  } // end of if (a==b)
  

In other words, there are no extraneous spaces. Perhaps this problem
is specific to your setup.


Paul


 > 
 > The solution is to set the 'no-self-insert property of the
 > tempo-template-* defuns.
 > These tempo-template defuns are created in
 > jde-gen-define-abbrev-template in jde-gen.el
 > Here is the hacked code:
 > 
 > (defun jde-gen-define-abbrev-template (abbrev template)
 >   "Defines a TEMPLATE that replaces ABBREV when you type ABBREV
 > in a JDE source buffer. TEMPLATE is a list of tempo template
 > elements. See `tempo-define-template' for information on
 > template elements. The resulting template is added to the
 > list bound to `jde-gen-abbrev-templates'. "
 >   (let ((template-name (concat "jde-gen-" abbrev)))
 >     (defalias (intern template-name)
 >       (tempo-define-template
 >        template-name
 >        template 
 >        abbrev 
 >        (format "JDE template for %s control flow abbreviation." abbrev)
 >        'jde-gen-abbrev-templates))
 >     (put (intern (concat "tempo-template-" template-name))
 > 'no-self-insert t)))
 > 
 > I am sure the defun could be optimized and integrated into jde or
 > defadvised(?).
 > 
 > Paul, can you integrate this?
 > 
 > 

Reply via email to