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

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

Re: efficient replacing – really faster compared to using the mouse?


From: B. T. Raven
Subject: Re: efficient replacing – really faster compared to using the mouse?
Date: Fri, 10 Aug 2012 13:44:15 -0500
User-agent: Mozilla/5.0 (Windows NT 5.0; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Die Fri Aug 10 2012 10:21:48 GMT-0500 (Central Daylight Time) Ferdinand
<Ferdinand.Gruebler@gmx.de> scripsit:

> Hi,
> 
> I am currently trying to get used to emacs.
> Before I heavily relied on TextMate (on Mac OS).
> 
> A lot of people claim that, once you learned all the shortcuts, emacs is much 
> faster without ever using the mouse.
> 
> 
> I just ran into a problem where I really couldn't figure out how to do this 
> with emacs at all.
> Eventually I switched back to TextMate ...
> 
> 
> So, probably I just am not aware of some key-combinations or there are other 
> tricks I don't know, so I thought I just ask some emacs-professionals here on 
> the list.
> 
> 
> Here is the specific problem:
> 
> I have a html table with a lot of radio buttons.
> These radio buttons have names (xyz + a number).
> Now I have to change all the numbers in the following way:
> 
> 
> - orignal:
> ----------
> 
> print("<tr>\n");
> 
>     ... something else ...
> 
>       print("<td class='Button'> <input type='radio' name='xyz23' value='0'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz23' value='1'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz23' value='2'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz23' value='3'> 
> </td>\n");
>       
> print("</tr>\n");
> 
> 
> print("<tr>\n");
> 
>     ... something else ...
> 
>       print("<td class='Button'> <input type='radio' name='xyz54' value='0'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz54' value='1'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz54' value='2'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz54' value='3'> 
> </td>\n");
>       
> print("</tr>\n");
> 
> [....]
> 
> 
> 
> edited:
> -------
> 
> print("<tr>\n");
> 
>     ... something else ...
> 
>       print("<td class='Button'> <input type='radio' name='xyz1' value='0'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz1' value='1'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz1' value='2'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz1' value='3'> 
> </td>\n");
>       
> print("</tr>\n");
> 
> 
> print("<tr>\n");
> 
>     ... something else ...
> 
>       print("<td class='Button'> <input type='radio' name='xyz2' value='0'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz2' value='1'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz2' value='2'> 
> </td>\n");
>       print("<td class='Button'> <input type='radio' name='xyz2' value='3'> 
> </td>\n");
>       
> print("</tr>\n");
> 
> [and so on]
> 
> 
> 
> Now in TextMate I just switch to column-mode with my mouse (by pressing alt 
> while selecting).
> Then I draw a rectangle with the mouse to select the number behind xyz of one 
> <tr>-block and type in the right number.
> This is fairly easy to me and quite quick.
> 
> In emacs I just have no idea how to do this in a reasonable amount of time.
> Only to navigate to the next block with C-n / C-p and to get to the right 
> place in the line with C-b / C-f takes a lot of time.
> And then to mark the beginning (with C-space) navigate to the end to replace 
> it ...
> 
> That is much less efficient compared to using the mouse (in my opinion).
> 
> 
> So what am I doing wrong here?
> How do you solve such edits in emacs efficiently?
> 
> 
> Thanks for any suggestions!


It depends on what you mean by a lot of radio buttons, 20 or 20000? In
your specific example it seems to me that M-% z23 z1 ent spc spc spc
spc, and likewise with the rest of names would accomplish your task as
fast in Emacs as in textmate and would even work if columns are not
aligned. An elisp programmer could probably write a short routine using
regular expressions and some kind of counter to rename 20000 blocks of 4
names ending in xyz##### into xyz%%%% where numbers ##### are not in
order and %%%% are forced to be sequential.

Ed



reply via email to

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