From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: C K Kashyap Newsgroups: gmane.emacs.help Subject: String replace with lisp code Date: Mon, 18 Jul 2011 11:06:53 +0530 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd5f2e4fa3e1e04a85162f4 X-Trace: dough.gmane.org 1310967521 5728 80.91.229.12 (18 Jul 2011 05:38:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2011 05:38:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 18 07:38:38 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QigXN-0000qf-Nq for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Jul 2011 07:38:37 +0200 Original-Received: from localhost ([::1]:41131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QigXM-0006zZ-CH for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Jul 2011 01:38:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QigVk-0006z8-0x for help-gnu-emacs@gnu.org; Mon, 18 Jul 2011 01:36:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QigVi-00052O-IN for help-gnu-emacs@gnu.org; Mon, 18 Jul 2011 01:36:55 -0400 Original-Received: from mail-fx0-f52.google.com ([209.85.161.52]:45598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QigVi-00052G-6I for help-gnu-emacs@gnu.org; Mon, 18 Jul 2011 01:36:54 -0400 Original-Received: by fxd18 with SMTP id 18so4918121fxd.39 for ; Sun, 17 Jul 2011 22:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=3B5XmP2oLqLud1KLEgeZJcAhZ9uA9LhHP+ZjLto5BNE=; b=A6dutuxNwP6md5mKfpMlPO6GykR6r0KWEOJlyU4oL5Zdga393AXWnWP8unFpApXT1z fGY5m5IponOdqm/BGiZFgIUp4YixKF0FSJ/UgU5dBh1nlcTa1/UNLv0q0b7I/qK+/f76 z5mVzw5Frq2BCHgyUnSaNw6HAfGaq4un3L6Q4= Original-Received: by 10.223.61.72 with SMTP id s8mr9563270fah.6.1310967413226; Sun, 17 Jul 2011 22:36:53 -0700 (PDT) Original-Received: by 10.223.120.74 with HTTP; Sun, 17 Jul 2011 22:36:53 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.52 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81640 Archived-At: --000e0cd5f2e4fa3e1e04a85162f4 Content-Type: text/plain; charset=ISO-8859-1 Hi, During search/replace, how can I use the evaluation of a lisp expression as the substitution string? An example could be ... say I want to replace the occurrence of a certain word with the word prefixed with its occurrence count - For example - If I'd like to replace the occurrence of sea in - She sells sea shells on the sea shore with She sells (1)sea shells on the (2)sea shore. Or perhaps a more frequent use case of adding line number to each line (while I was typing this, I got the idea of using the keyboard macro to achieve this .... is there a better way though?) Regards, Kashyap --000e0cd5f2e4fa3e1e04a85162f4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,
During search/replace, how can I use =A0the evaluation of a lisp ex= pression as the substitution string?

An example co= uld be ... say I want to replace the occurrence of a certain word with the = word prefixed with its occurrence count -=A0

For example - =A0If I'd like to replace the occurre= nce of sea in =A0-=A0
She sells sea shells on the sea shore
=
with
She sells (1)sea shells on the (2)sea shore.
=
Or perhaps a more frequent use case of adding line number to eac= h line

(while I was typing this, I got the idea of= using the keyboard macro to achieve this .... is there a better way though= ?)

Regards,
Kashyap=A0
--000e0cd5f2e4fa3e1e04a85162f4--