From: Pascal Bourguignon <pjb@informatimago.com>
Subject: Re: Replacing ocurrences of a string...
Date: Fri, 13 May 2005 16:35:54 +0200 [thread overview]
Message-ID: <87acmzb3cl.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: mailman.5053.1115990680.2819.help-gnu-emacs@gnu.org
luca.spinacci@seleniacomms.com 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"
"********************\n"
"* "funame"\n"
"********************\n"
"*/\n"
"void "funame"()\n"
"{\n"
" \n"
"}//"funame"\n\n"))
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
next parent reply other threads:[~2005-05-13 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5053.1115990680.2819.help-gnu-emacs@gnu.org>
2005-05-13 14:35 ` Pascal Bourguignon [this message]
2005-05-13 15:04 ` Replacing ocurrences of a string Greg Rowe
2005-05-13 13:15 luca.spinacci
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=87acmzb3cl.fsf@thalassa.informatimago.com \
--to=pjb@informatimago.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.