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

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

Re: putting double quotes efficiently


From: Andreas Röhler
Subject: Re: putting double quotes efficiently
Date: Mon, 03 Jun 2013 09:55:47 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Am 03.06.2013 09:26, schrieb Andreas Röhler:
Am 03.06.2013 07:43, schrieb C K Kashyap:
Hi,
I am looking for a way to transform

print line1
print line two
print line3

into

print "line1";
print "line two";
print "line3";

most efficiently. For the first quote of each line I place the cursor
before line1 and I set the mark and then move all the way down to just
before line3 and then do a C-x-r-t " <RET>
Then I do a regexp replace to change $ to ";

I'd like to do better. While at it, can I please also know how I can use
the line range in the mark set mode in user defined function?

Regards,
Kashyap


M-x query-replace-regexp

^\([^ ]+\) \(.+\)
RET
\1 "\2;
RET



resp. with missing " in replace expression

 \1 "\2";



reply via email to

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