From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Replacing ocurrences of a string... Date: Fri, 13 May 2005 16:35:54 +0200 Organization: [posted via Easynet Spain] Message-ID: <87acmzb3cl.fsf@thalassa.informatimago.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115994714 31461 80.91.229.2 (13 May 2005 14:31:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 May 2005 14:31:54 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 13 16:31:48 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DWbBj-0000k7-GS for geh-help-gnu-emacs@m.gmane.org; Fri, 13 May 2005 16:30:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWbKt-0002Lo-C5 for geh-help-gnu-emacs@m.gmane.org; Fri, 13 May 2005 10:40:19 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!easynet-quince!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4dnUGdGsb/jRDFAdXub2UvLj5C8= Original-Lines: 52 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=_e``K>@2D5`LBGU>2`W4ocEY<>`XO4V7m>Uh List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26561 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26561 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 string > on direct request. > Let's say: > M-x my-template-generator > > generates in my - C - buffer > a template like > > /* > ********************** > * > ********************** > void () > { > > > } // > > I would like to be prompted for the function name to be replaced with. > Using (query-replace "" "") 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 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.