home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / emacs / help / 3777 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.4 KB  |  86 lines

  1. Newsgroups: gnu.emacs.help
  2. 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
  3. From: rcox@cad625.intel.edu (Richard Cox)
  4. Subject: simple insertion hook
  5. Message-ID: <Bt72Go.D6G@nntp-sc.Intel.COM>
  6. Sender: rcox@cad625 (Richard Cox)
  7. Nntp-Posting-Host: 143.183.106.35
  8. Reply-To: rcox@scdt.intel.com
  9. Organization: Intel Corporation
  10. Date: Tue, 18 Aug 1992 19:36:23 GMT
  11. Lines: 73
  12.  
  13.  
  14. Hi I am trying to make a simple function which basically inserts some text into
  15. a buffer.  I am a new Emacs-Lisp programmer but well versed in Common Lisp.  
  16. A) why do I get the small bug described below.  B) is there a better way to do
  17. something like this.  (I use this as a function from and abbrev-table).
  18.  
  19.   (defun class-c++ ()
  20.     (let ((class (read-string "Class name : "))
  21.       pos)
  22.       (if (string-equal (substring class -1) ";")
  23.       (insert "class " class)
  24.     (beginning-of-buffer)
  25.     (insert "#ifndef "  class  "_hh")
  26.     (newline)
  27.     (insert "#define "  class "_hh")
  28.     (newline 2)
  29.     (insert "class " class )
  30.     (newline)
  31.     (insert "{")
  32.     (newline)
  33.     (insert "public:")
  34.     (newline)
  35.     (insert class " ();")
  36.     (newline)
  37.     (insert "~" class " ();")
  38.     (newline)
  39.     (setq pos (point))
  40.     (newline)
  41.     (insert "private:")
  42.     (newline 2)
  43.     (insert "};   //  End of class " class )
  44.     (newline 4)
  45.     (insert "#endif   // End of " class "_hh")
  46.     (newline 4)
  47.     (goto-char pos)
  48.     (c++-indent-defun)
  49.     )
  50.       )
  51.     )
  52.  
  53. The ouput I get for NodeBrowse is below but there is an extra space after the 
  54. 'B' in the destructor.  I always seem to get a space after the last Capitol 
  55. letter in the class name????  any ideas?
  56.  
  57. #ifndef NodeBrowse_hh
  58. #define NodeBrowse_hh
  59.  
  60. class NodeBrowse
  61. {
  62.  public:
  63.     NodeBrowse ();
  64.     ~NodeB rowse ();
  65.     
  66.   private:
  67.     
  68. };                   //  End of class NodeBrowse
  69.  
  70.  
  71.  
  72. #endif                   // End of NodeBrowse_hh
  73. Thanks in advance
  74.  
  75. -Rich
  76.  
  77.  
  78. +-----------------------------------------------------------------------------+
  79. |Rich Cox                                              E-Mail: rcox@scdt.intel.com           |
  80. |CAD Developer                             AOL: Rich Kid                      |
  81. |Intel Corp.                     Mailstop: SC3-39               |
  82. |                                        Phone: (408) 765-5199              |
  83. |-----------------------------------------------------------------------------+
  84. | These opinions are shared by everyone, I asked them...                      |
  85. +-----------------------------------------------------------------------------+
  86.