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

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

RE: What's your favourite *under_publicized* editing feature ofEmacs?


From: Drew Adams
Subject: RE: What's your favourite *under_publicized* editing feature ofEmacs?
Date: Fri, 28 Jan 2011 10:25:00 -0800

> Or use what is already there since 23.1:
> <f3> runs the command kmacro-start-macro-or-insert-counter...
> <f4> runs the command kmacro-end-or-call-macro...

It's unfortunate however that two repeatable keys were wasted for these default
bindings.  Repeatable keys are better reserved for operations that you want to
easily repeat by just holding down a key or chord.

Yes, you can use `f4' for both ending a macro definition and executing the
macro, and the latter operation is repeatable.  Still, it is better to use a
repeatable suffix on a prefix key for this, e.g. `C-x e e e...' (which you can
already use as an alternative to `f4 f4 f4...').  Single repeatable keys are a
valuable resource and should not be wasted.

`f3' and `f4' also do not offer mnemonic help.

Consider by contrast the keys bound to `kmacro-start-macro' and
`kmacro-end-macro': `C-x (' and `C-x )'.  Those bindings were made decades ago
(to the parents of the current commands: `start-kbd-macro' and `end-kbd-macro').
They are mnemonic, visually indicating start and end, and they are not easily
repeatable by holding keys down.  Start/end have no need to be repeatable.

In the past Emacs also used the similar keys `C-x [' and `C-x ]' for generating
the corresponding Emacs-Lisp code while defining a keyboard macro.  I don't
recall whether those keys were in Gnu Emacs or some other Emacs from days of
yore.  The point is that here too mnemonic start/end keys were used, and no
repeatable keys/chords were wasted gratuitously.  (Yes, it is also true that
natural pairs such as () [] \/ and <> are rare and should be used judiciously.)

There was some discussion back in 2002 about wasting `f3' and `f4' for this.  At
first (with no discussion AFAICT), `f7' and `f8' were implemented for it - same
problems obviously.  A user pointed out that function keys `f5' to `f9' are
supposed to be reserved for users to bind, so the macro commands got moved to
`f3' and `f4'.

What was the main argument for binding kmacro commands to such keys?  "I need to
bind them to two adjacent function keys" and "it makes a nice interface to have
this on two function keys next to each other".  Which is no reason at all (why
do they need to be adjacent? why do they need to be on function keys?).

The other arguments given in support of wasting `f3|4' for this: (a) "I don't
see why we should hide an excellent feature like keyboard macros", (b) keys like
`C-x (' are "way too cumbersome" for defining a macro, and (c) "I really don't
understand why binding function keys by default is worth making a fuzz about".

(b) is the most misguided of these: you don't need a quick, repeatable key just
to turn on/off keyboard recording.  Use easily repeatable keys for repeatable
operations (incremental changes, cycling, etc.), and use keys that are a bit
more cumbersome for one-off operations such as on/off, start/end.

To their credit, Stefan and Miles argued against using function keys for this,
but with no success.  This was the last word, from RMS:

"I think there is no harm in supporting F3 and F4 as well as
C-x (, C-x ) and C-x e and C-x C-k, if users like F3 and F4.
We could take a poll and ask them."

AFAIK no poll was ever taken.

Although Stefan's suggestion to use `C-x e e e...' to repeat macro execution was
also implemented, `f3' and `f4' remain bound by default, and `C-x e e e...' took
a back seat in the doc (and consequently in practice, no doubt), seemingly as an
afterthought.  There isn't even any mention of the `C-x e' option
`kmacro-call-repeat-key'.

http://lists.gnu.org/archive/html/emacs-devel/2002-08/msg00760.html




reply via email to

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