Please help with abbrev - problem

[email protected] Wed, 9 Feb 2005 15:01:47 +0100
Newsgroups gmane.emacs.xemacs.general
Message-ID <OFF3318B53.1A823BC9-ONC1256FA3.004C2105-C1256FA3.004D57B6@pruftechnik.com>
Hello,

Since I am an ugly lazy typer, I have several abbrevs for c keywords. They 
are all working fine. Now I wanted to become a bit more lazy and create an 
abbrev for the following:

When I type 

bool 

this should bee expanded to:

bool m_b

With the cursor directly after the trailing 'b', so that I can type the 
name. I got quite close:

(defun load-c++-mode-abbrev-table ()
  (clear-abbrev-table c++-mode-abbrev-table)
  (define-abbrev-table 'c++-mode-abbrev-table
    '(
      ( "for" "" mg-skel-c-for 0 )
      ( "if" "" mg-skel-c-if 0 )
      ( "else" "" mg-skel-c-else 0 )
      ( "while" "" mg-skel-c-while 0 )
      ( "do" "" mg-skel-c-do 0 )
      ( "switch" "" mg-skel-c-switch 0 )
      ( "case" "" mg-skel-c-case 0 )
      ( "bool" "" mg-skel-c-bool 0 )
      )
    )
  (put 'c++-mode-abbrev-table 'no-self-insert t)
  )

(defun mg-skel-c-bool()
  "Inserts a boolean according to coding conventions.\n This sould be 
called from an abbrev."
  ( skeleton-insert
    '( nil "bool m_b" _ ))
  )

What I get when I type 'bool ' is (  '_' marks the cursor)

bool m_b _

So there is a space between the trailing 'b' and the cursor. I did not 
manage to get rid of this &*%$£ space ...
Can you help me, please ?

Mit freundlichen Grüßen

Markus Grunwald
Softwareentwicklung

PRÜFTECHNIK Condition Monitoring GmbH
Oskar-Messter-Straße 19-21
85737 Ismaning
www.pruftechnik.com
Tel: +49 (0)89 99616177
Fax: +49 (0)89 99616200