Paul,
I think I may not have been clear as to what the problem is, so here
goes...
when I type
if<space>
^
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
<tab>if (a==b) {
<tab><tab><space>
^^^^^^^-----------------------problem.
<tab>}
where <tab>s are due to indent function. The problem is the <space> char
that types which triggered
the completion is also inserted. If I type <return> after 'if' then that
<return> is inserted in the buffer.
The solutions I proposed/indicated take care of that problem.
regards,
sandip
-----Original Message-----
From: Paul Kinnucan [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 20, 2003 9:23 PM
To: Chitale, Sandip V
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: if template
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?
>
>