unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
[parent not found: <mailman.262.1077404990.340.help-gnu-emacs@gnu.org>]
* regexp / replacement for variable
@ 2004-02-21 23:08 Jan Misol
  2004-02-24 13:31 ` Kevin Dziulko
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Misol @ 2004-02-21 23:08 UTC (permalink / raw)


I'm new to elisp but I want my beloved editor
to generate the standard c-header stuff when creating
a new .h/.hpp header.

> c-x c-f test.h

should automatically insert:

   #ifndef _TEST_H_
   #ifndef _TEST_H_


   #endif

depending on the given filename.

I put the following to my .emacs file:

   (defun new-c-header ()
     "Insert c-header skeleton."
     (interactive "")
     (progn
       (setq bname (upcase(buffer-name)))
       (insert
        (message "#ifndef %s\n\#define %s\n\n#endif"
           bname bname))))

Apart from knowing that "message" might not be the right
choice here, I don't know how to modify the value of bname!?
"replace-regexp" doesn't seem to be the what I'm looking for.

(and how could the new-c-header() be invoked by creating a
new .h/.cpp file?)

jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-02-24 20:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.372.1077629684.340.help-gnu-emacs@gnu.org>
2004-02-24 14:03 ` regexp / replacement for variable Joakim Hove
2004-02-24 20:09 ` Floyd Davidson
     [not found] <mailman.262.1077404990.340.help-gnu-emacs@gnu.org>
2004-02-22  0:41 ` Kin Cho
2004-02-22  0:51 ` lawrence mitchell
2004-02-22 12:18   ` Jan Misol
2004-02-22 12:14 ` Floyd Davidson
2004-02-21 23:08 Jan Misol
2004-02-24 13:31 ` Kevin Dziulko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).