Hi Sandip,
I haven't had time to evaluate your proposed enhancement. I hope
to get to it this evening. I'll let you know as soon as I do.
Paul
Chitale, Sandip V writes:
> FRC posted this on gnu.emacs.help:
>
> <FRC post>
> It goes like this in the jde-mode-hook of my .emacs:
>
> (mapatoms
> (lambda (symb) (and (symbolp (symbol-function symb)) (string-match
> "tempo-template-jde-gen" (symbol-name (symbol-function symb)))
> (put (symbol-function symb) 'no-self-insert t)))
> local-abbrev-table)
>
> I'm still an Emacs-Lisp rookie, so there might be a better way to get
> the same result.
> Note that it somewhat messed with completions within comments, as in
> these cases I do want the space insertion but the expansion (even if
> void) eats it unconditionally. This is a minor pb AFAIC and quoting
> with C-q does the job.
>
> HTH,
>
> FRC
> </FRC post>
>
> -----Original Message-----
> From: Chitale, Sandip V
> Sent: Wednesday, September 17, 2003 12:08 PM
> To: '[EMAIL PROTECTED]'; 'Paul Kinnucan'
> Cc: '[EMAIL PROTECTED]'
> Subject: if template
>
>
>
> 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>
>
> 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?
>
>