[EMAIL PROTECTED] 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. _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs