help-gnu-emacs
[Top][All Lists]
Advanced

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

String replace with lisp code


From: C K Kashyap
Subject: String replace with lisp code
Date: Mon, 18 Jul 2011 11:06:53 +0530

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 

reply via email to

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