home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / emacs / help / 4004 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.9 KB  |  50 lines

  1. Path: sparky!uunet!stanford.edu!ames!pacbell.com!pacbell!oracle!unrepliable!bounce
  2. Newsgroups: gnu.emacs.help
  3. From: wmesard@tofu.oracle.com (Wayne Mesard)
  4. Subject: Re: Can I expand an abbrev without the space getting added on the end ?
  5. In-Reply-To: glenn@prl.philips.co.uk's message of 3 Sep 92 11:45:31 GMT
  6. Message-ID: <WMESARD.92Sep4121833@tofu.oracle.com>
  7. Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
  8. Nntp-Posting-Host: tofu.us.oracle.com
  9. Organization: /home/wmesard/.organization
  10. References: <1723@prlhp1.prl.philips.co.uk>
  11. Date: Fri, 4 Sep 1992 20:18:33 GMT
  12. X-Disclaimer: This message was written by an unauthenticated user
  13.               at Oracle Corporation.  The opinions expressed are those
  14.               of the user and not necessarily those of Oracle.
  15. Lines: 33
  16.  
  17. glenn@prl.philips.co.uk (Glenn Coombs) writes:
  18. > I have just written the following bit of code:
  19. > (defun magic-main ()
  20. >   "insert a main () construct automatically"
  21. >   (beginning-of-line)        ; put main at margin
  22. >   (delete-horizontal-space)
  23. >   (end-of-line)
  24. >   (insert-string "\n{\n\t\n}")
  25. >   (search-backward ")"))
  26. > (define-abbrev c-mode-abbrev-table "main" "main ()" 'magic-main)
  27.  
  28. > the
  29. > space that I type after main in order to get it expanded gets added
  30. > in after the expansion call has been executed.
  31. [...]
  32. > and I have to manually delete a space.  Does anyone know of a way to
  33. > stop this space from appearing or a way to work round it ?
  34.  
  35. The insertion of the character you type is the very last thing that
  36. happens during the abbrev-expansion procedure and there's no opportunity
  37. for client elisp code to suppress that.
  38.  
  39. If you explicitly expand the abbrev via "Control-x '" you won't get an
  40. extra space.  I suggest you do that.  Also, if you type some other
  41. character to get the abbrev expanded, such as a comma, then you'll get
  42. that character instead of the Space.
  43.  
  44. There is no over way around this.  Believe me, I've tried.
  45. --
  46. Wayne();
  47. WMesard@us.Oracle.COM
  48.