From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jan Misol Newsgroups: gmane.emacs.help Subject: regexp / replacement for variable Date: Sun, 22 Feb 2004 00:08:54 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <4037E506.6030701@liblss.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1077405052 18604 80.91.224.253 (21 Feb 2004 23:10:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2004 23:10:52 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 22 00:10:41 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AugGf-0002pc-00 for ; Sun, 22 Feb 2004 00:10:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AugG2-0001yC-Nv for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Feb 2004 18:10:02 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AugFo-0001xQ-4m for help-gnu-emacs@gnu.org; Sat, 21 Feb 2004 18:09:48 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AugFH-0001hE-6A for help-gnu-emacs@gnu.org; Sat, 21 Feb 2004 18:09:47 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1AugFG-0000fx-U0 for help-gnu-emacs@gnu.org; Sat, 21 Feb 2004 18:09:14 -0500 Original-Received: from [217.115.142.79] (helo=marge.webpack.hosteurope.de) by mx20.gnu.org with esmtp (Exim 4.30) id 1AugEo-0006OE-D3 for help-gnu-emacs@gnu.org; Sat, 21 Feb 2004 18:08:46 -0500 Original-Received: from liblss.org (misol.home.cs.tu-berlin.de [130.149.149.92]) (authenticated) by marge.webpack.hosteurope.de (8.11.6/8.11.6) with ESMTP id i1LN8jG13152 for ; Sun, 22 Feb 2004 00:08:45 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 X-Accept-Language: de, en Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17057 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17057 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