home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!warwick!str-ccsun!strath-cs!prlhp1!glenn
- From: glenn@prl.philips.co.uk (Glenn Coombs)
- Newsgroups: gnu.emacs.help
- Subject: Can I expand an abbrev without the space getting added on the end ?
- Message-ID: <1723@prlhp1.prl.philips.co.uk>
- Date: 3 Sep 92 11:45:31 GMT
- Sender: nntp@prlhp1.prl.philips.co.uk
- Organization: Philips Research Labs, Redhill, England
- Lines: 37
- Nntp-Posting-Host: prsun10q
-
-
- I have just written the following bit of code:
-
- (defun magic-main ()
- "insert a main () construct automatically"
- (beginning-of-line) ; put main at margin
- (delete-horizontal-space)
- (end-of-line)
- (insert-string "\n{\n\t\n}")
- (search-backward ")"))
-
- (define-abbrev c-mode-abbrev-table "main" "main ()" 'magic-main)
-
- which should expand a main to:
-
- main ()
- {
-
- }
-
- and leave the cursor just before the close bracket. However, the
- space that I type after main in order to get it expanded gets added
- in after the expansion call has been executed. This means that I end
- up with:
-
- main ( )
- {
-
- }
-
- and I have to manually delete a space. Does anyone know of a way to
- stop this space from appearing or a way to work round it ?
-
- --
-
- -
- Glenn ... glenn@prl.philips.co.uk
-