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: C K Kashyap
Subject: Re: putting double quotes efficiently
Date: Mon, 3 Jun 2013 13:33:46 +0530

Thanks Andreas,
This works.
Although I'd still like to know how to write custom function that work over
a marked region.
Regards,
Kashyap


On Mon, Jun 3, 2013 at 1:25 PM, Andreas Röhler <
andreas.roehler@easy-emacs.de> wrote:

> 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]