[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacing ocurrences of a string...

From: Pascal Bourguignon
Subject: Re: Replacing ocurrences of a string...
Date: Fri, 13 May 2005 16:35:54 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden writes:

> I generate a C function template in a buffer running a command.
> I would like to replace every occurence of the <name> string
> on direct request.
> Let's say:
> M-x my-template-generator
> generates in my - C - buffer
> a template like
> /*
> **********************
> * <name>
> **********************
> void <name>()
> {
> } // <name>
> I would like to be prompted for the function name to be replaced with.
> Using (query-replace "<name>" "") in "my-template-generator" I have to
> call SHIFT-e to be requested for "Edit replacement string: "  and
> SHIFT-1 to replace every occurence of <name> with the new string "my-name".
> Is there a smarter way (I'm sure there is) to be requested for the
> replacement
> string ("Edit replacement string: ") automatically as the template is
> inserted
> in the buffer without using SHIFT-e?
> The function query-replace is not mandatory...

Usually, this is done by programming correctly my-template-generator:

(defun my-template-generator (funame)
   (interactive "sFunction name: ")
   (insert "/*\n"
           "* "funame"\n"
           "void "funame"()\n"
           "    \n"

__Pascal Bourguignon__           

Nobody can fix the economy.  Nobody can be trusted with their finger
on the button.  Nobody's perfect.  VOTE FOR NOBODY.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]