all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Dziulko <weaselboy1976@yahoo.com>
Subject: Re: regexp / replacement for variable
Date: Tue, 24 Feb 2004 05:31:01 -0800 (PST)	[thread overview]
Message-ID: <20040224133101.74784.qmail@web41806.mail.yahoo.com> (raw)
In-Reply-To: <4037E506.6030701@liblss.org>


[-- Attachment #1.1: Type: text/plain, Size: 1524 bytes --]

I find file templates easier.  I have this in my .emacs:
 
;; automaticlly start new files with specific templates
(autoload 'auto-insert "autoinsert")
     (add-hook 'find-file-not-found-hooks 'auto-insert)
     (setq auto-insert-query nil)
     (setq auto-insert-directory "myhomedir/.templates/")
     (setq auto-insert-alist
        '(("\\.sh$"       . "template.sh")
          ("\\.pl$"       . "template.pl")))
 
Now all my new *.pl files look like whatever .templates/template.pl looks like.

Jan Misol <misol@liblss.org> wrote:
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


_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

---------------------------------
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.

[-- Attachment #1.2: Type: text/html, Size: 2248 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

  reply	other threads:[~2004-02-24 13:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-21 23:08 regexp / replacement for variable Jan Misol
2004-02-24 13:31 ` Kevin Dziulko [this message]
     [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
     [not found] <mailman.372.1077629684.340.help-gnu-emacs@gnu.org>
2004-02-24 14:03 ` Joakim Hove
2004-02-24 20:09 ` Floyd Davidson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040224133101.74784.qmail@web41806.mail.yahoo.com \
    --to=weaselboy1976@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.