home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.help
- Path: sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!iWarp.intel.com|imutm1.de.intel.com!inews.Intel.COM!cad625!rcox
- From: rcox@cad625.intel.edu (Richard Cox)
- Subject: simple insertion hook
- Message-ID: <Bt72Go.D6G@nntp-sc.Intel.COM>
- Sender: rcox@cad625 (Richard Cox)
- Nntp-Posting-Host: 143.183.106.35
- Reply-To: rcox@scdt.intel.com
- Organization: Intel Corporation
- Date: Tue, 18 Aug 1992 19:36:23 GMT
- Lines: 73
-
-
- Hi I am trying to make a simple function which basically inserts some text into
- a buffer. I am a new Emacs-Lisp programmer but well versed in Common Lisp.
- A) why do I get the small bug described below. B) is there a better way to do
- something like this. (I use this as a function from and abbrev-table).
-
- (defun class-c++ ()
- (let ((class (read-string "Class name : "))
- pos)
- (if (string-equal (substring class -1) ";")
- (insert "class " class)
- (beginning-of-buffer)
- (insert "#ifndef " class "_hh")
- (newline)
- (insert "#define " class "_hh")
- (newline 2)
- (insert "class " class )
- (newline)
- (insert "{")
- (newline)
- (insert "public:")
- (newline)
- (insert class " ();")
- (newline)
- (insert "~" class " ();")
- (newline)
- (setq pos (point))
- (newline)
- (insert "private:")
- (newline 2)
- (insert "}; // End of class " class )
- (newline 4)
- (insert "#endif // End of " class "_hh")
- (newline 4)
- (goto-char pos)
- (c++-indent-defun)
- )
- )
- )
-
- The ouput I get for NodeBrowse is below but there is an extra space after the
- 'B' in the destructor. I always seem to get a space after the last Capitol
- letter in the class name???? any ideas?
-
- #ifndef NodeBrowse_hh
- #define NodeBrowse_hh
-
- class NodeBrowse
- {
- public:
- NodeBrowse ();
- ~NodeB rowse ();
-
- private:
-
- }; // End of class NodeBrowse
-
-
-
- #endif // End of NodeBrowse_hh
- Thanks in advance
-
- -Rich
-
-
- +-----------------------------------------------------------------------------+
- |Rich Cox E-Mail: rcox@scdt.intel.com |
- |CAD Developer AOL: Rich Kid |
- |Intel Corp. Mailstop: SC3-39 |
- | Phone: (408) 765-5199 |
- |-----------------------------------------------------------------------------+
- | These opinions are shared by everyone, I asked them... |
- +-----------------------------------------------------------------------------+
-