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

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

Re: Emacs Book Vs Emacs Manuals


From: Marcin Borkowski
Subject: Re: Emacs Book Vs Emacs Manuals
Date: Sat, 27 Jun 2015 10:25:38 +0200

On 2015-06-27, at 07:02, Bob Proulx <bob@proulx.com> wrote:

> Rusi wrote:
>> Emanuel Berg wrote:
>> > %% (replace-regexp "^\\(.*&.*&\\).*&\\(.*\\)" "\\1\\2")
>>
>> 51 chars (ignoring that things like ^& are shift chords)
>> 
>> F3
>> C-s & RET C-SPC C-s C-s RET C-w C-a C-n
>> F4
>> 
>> 16 keystrokes counting each chord as 1 1/2 keys
>
> I don't think keyboard golf is the best justification for something.
> It helps.  But for me keyboard macros are simply more interactive.
> They are a way to quickly multiply one keystroke into many.
>
> But the above does make me realize that I often use keyboard macros
> when the "shape" of the text is a factor in the editing of it.  Such
> as when I need to make edits around something both above and below
> it.  I might need to move a chunk of text up or down or otherwise
> mutate it in unusual ways while editing.  During the keyboard macro I
> can search for something, then search for something different, perhaps
> several times to land on the right starting point.  Then I can move up
> or down spatially to be where I want to be.  That is much harder to do
> with regular expression.  I grew up with regular expressions and use
> them all of the time.  But I use different tools at different times.

Exactly.

Macros are especially nice in that they mimic the way you edit text.
You can do that in Elisp, too, or sometimes regexen, but Elisp requires
a lot of typing and regexen require a lot of thinking; both are energy-
and time-consuming.  OTOH, there are cases when macros won't do
(conditional expressions, loops – they are doable in macros – see Calc
manual – but much less intuitive, at least for me).

> Here is a contrived example.  Split the buffer into two windows.

Nice!


> Regular expressions are awesome.  But keyboard macros are awesome too.

Yes.

> Bob

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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