unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs default key bindings    [was: Opening Up More Keymaps Re: Standardizing more key bindings?]
@ 2020-10-02 18:14 Drew Adams
  2020-10-02 19:21 ` Philip K.
  2020-10-02 19:24 ` Ergus
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2020-10-02 18:14 UTC (permalink / raw)
  To: T.V Raman, Thibaut Verron; +Cc: emacs-devel

> Perhaps it's time we opened up some additional keymaps...

Stayed out of this thread so far, hoping it would die
a healthy natural death. ;-)  But here are my general
thoughts on the matter, FWIW.
___


1. Keyboard keys are scarce.  Many are already "taken"
by default by Emacs.  (Yes, of course, users and
libraries can always _override_ any default bindings.)

Some of the keys Emacs has "taken" could fruitfully
be revisited.

Some are easily repeatable keys that are bound by
default to nonrepeatable commands, i.e., commands
that it makes no sense to hold the key down to repeat.

Some are particularly easy/quick to type, and are
bound to commands that might not be used that often.

Some were perhaps taken only because a key seemed to
be free at the time (often long ago), regardless of
how much a default binding was needed.  (Recently F2
has come up, as having been sacrificed for the
relatively unused/not-so-useful `2C-*' commands.)

Any such keys could be looked at as keys we might
possibly want to "open up".

(And no, I'm not saying that there aren't other
things to take into account when deciding on a
default key binding.  Ease/speed of finger access,
for example.)


2. But what do we mean by "open up" or "free" a
default key binding?  _I_ mean free it for use by
users and 3rd-party libraries.  Have Emacs give it
up - let it go.

I don't mean for Emacs to just bind it to something
different by default.  That's _not_ freeing it up;
that's just rearranging.  Rearranging can be useful
sometimes, but it doesn't help with the problem of
Emacs binding too many keys by default.

Some here feel the pinch as Emacs not having enough
free keys to bind to more commands by default.  I
feel the problem is the opposite: the pinch is on
users and 3rd-party libraries, and Emacs is doing
the pinching.  Some here see a "free" key and want
to bind it by default, sometimes to their shiny
new command.


3. There's been a tendency recently to give Emacs
even more default key bindings.  Two cases come
to mind, both in 2020:

a. `C-x p' was taken by Emacs as a prefix key for
   `project.el' commands.
b. `C-x t' was taken by Emacs as a prefix key for
   `tabbar.el' commands.

Maybe those deserve prefix keys (?).  But you see
the tendency - less and less for users; more taken
by default bindings.

That's 2 excellent prefix keys just removed, in
effect, from the user/3rd-party space.  Poof!

For example, in my code I've used `C-x p' and
`C-x 4 p' as prefix keys for Bookmark+ for over
10 years, but I changed them (`C-x x', `C-x 4 x')
in 2020 because of (a).

(I have 86 key bindings organized onto those two
prefix keys - some on submaps: `C-x x a',
`C-x x b', `C-x x c', `C-x x t', `C-x x t +',...)

And I've used `C-x t' as a suggested prefix key
for library DoReMi for 16 years.  But I'll have to
change that in 2020 because of (b).

I pointed this out here at the time.  Response was,
in effect, "tough tiddlywinks".  OK.

https://lists.gnu.org/archive/html/emacs-devel/2019-12/msg00085.html

The point is that instead of Emacs trying to reserve
_more_ keys as free for its users (without having to
override default bindings), the impetus here has
been to sacrifice ever more keys to default bindings.


4. When Emacs does decide to bind a key by default,
these two general guidelines (at least) should be
considered, IMO.  (This applies to rearranging, as
well as to binding a previously free key.)  

1. Save naturally repeatable keys for commands that
   can be repeated, i.e., commands that it makes
   sense to be able to hold down a key to repeat.

2. Save some keys for prefix keys, as opposed to
   just sacrificing them for a single command.  A
   prefix key gives you a whole keyboard of
   possibilities for a single key.  Think of all
   the mileage we get out of the prefix key `C-x'!
   Of course, adding a prefix key makes a key
   sequence longer, more complex.  Tradeoff.


___________________

That point (#4) and the rest of this message
were part of a post of mine to help-gnu-emacs
on 9/23/2020, on pretty much this same topic:

https://lists.gnu.org/archive/html/help-gnu-emacs/2020-09/msg00273.html

I tend to define lots of keys for features I write,
and put them, by groups, on their own keymaps, and
then put those keymaps on prefix keys.

Even if such a prefix key appears complicated or
slow, the fact of using a separate keymap means
that a user can easily put it on a different,
shorter key, or remap it to a more global keymap.

Now imagine that keys aren't reserved by Emacs this
way - repeatable keys for repeatable commands, and
some keys available to be used as prefix keys.

Imagine if Emacs just predefined `C-x' for a single
command (e.g. `cut').  _Zillions_ of keys bound now
under `C-x' would be sacrificed.

At the very least, when a new key is decided to be
sacrificed by default (vanilla Emacs), it had better
be bound to a repeatable command, not one (such as
`cut') that it makes no sense to repeat.

And even a repeatable key is a sacrifice - consider
if `C-x' were bound to, say, `forward-word'.
Repeatable, yes, but think of all the bindings now
under `C-x' that would be lost.

Keyboard keys are precious - scarce.  Too many have
already been sacrificed to default bindings, IMO.
Sure, any user or library can redefine any keys.
But once blessed as a default vanilla-Emacs key
binding, a key is, for practical purposes, kinda
off limits for a library.

The point is that (1) it's easy to move a keymap
from one prefix key to another, and (2) there need
to be some prefix keys available to move maps to.

Eventually, I imagine (hope) that some simple,
repeatable keys that have been assigned default
Emacs bindings for commands that aren't repeatable,
or that aren't super useful, or that don't really
need a single-key binding, will be recycled and
put to better use: for repeatable commands, as
prefix keys, or just unbound by default and left
available for libraries.

No, I don't have particular suggestions, and no,
it's not urgent.

But consider `M-!', for example.  Sure, `!' is
mnemonic for shell.  But `M-!' is repeatable
(just hold it down), and it makes no sense to
repeat `shell-command'.  There are other default
key bindings like this - essentially wasted wrt
easy repetition.

Some nonrepeatable commands bound to repeatable
keys should be replaced by repeatable versions.
I do that for `C-a' and `C-e', for example, so
they're similar to `C-n' and `C-p' (repeatable).
That kind of change is minimal - it's the least
we can do to make things a little saner.

Take a look at `C-h b', and see which repeatable
keys are bound to nonrepeatable commands.  Not
too many, but there are some.

Even `C-w' is "wasted" on a nonrepeatable command.
Am I suggesting that `C-w' should not be bound by
default to `kill-region'?  Not really.  That's not
urgent, at least.  But hey, keys are limited - the
keyboard's a small planet. ;-)

And `beginning-of-buffer'.  That nonrepeatable
command's bound by default to two repeatable keys,
`M-<' and `C-home'.  Both mnemonic (good).  But...



^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Emacs default key bindings    [was: Opening Up More Keymaps Re: Standardizing more key bindings?]
@ 2020-10-02 18:46 arthur miller
  0 siblings, 0 replies; 8+ messages in thread
From: arthur miller @ 2020-10-02 18:46 UTC (permalink / raw)
  To: Drew Adams, T.V Raman, Thibaut Verron; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 8740 bytes --]

I usually say shortcuts are a scarce resource in Emacs; but I don't think it should be taken to seriously either. I think that most users when they are experienced enough with Emacs will rebind stuff either because they prefer other then default functionality or because some other setup make more sense for them.

Also in general if it is not enough with shortcuts, users can simply define extra prefixes. For example I do that in my jnit file:

(global-set-key (kbd "C-z") 'C-z-map)
(define-prefix-command 'C-f-map)
(global-set-key (kbd "C-f") 'C-f-map)
(define-prefix-command 'C-t-map)
(global-set-key (kbd "C-t") 'C-t-map)
(global-unset-key (kbd "C-v"))

It is not harder then so and it gives me any of shortcuts to play with.

Maybe the manual should be more explicit and encourage users to go and define their own prefixes and create their shortcuts. It also might be an idea to write a chapter on how to effectively work with Emacs, shortcuts and maybe some similar related stuff so users are more comfortable with exploring their own ideas instead or pre-canned solutions like Emacs defaults or evil/doom/etc.

-------- Originalmeddelande --------
Från: Drew Adams <drew.adams@oracle.com>
Datum: 2020-10-02 20:17 (GMT+01:00)
Till: "T.V Raman" <raman@google.com>, Thibaut Verron <thibaut.verron@gmail.com>
Kopia: emacs-devel <emacs-devel@gnu.org>
Ämne: Emacs default key bindings    [was: Opening Up More Keymaps Re: Standardizing more key bindings?]

> Perhaps it's time we opened up some additional keymaps...

Stayed out of this thread so far, hoping it would die
a healthy natural death. ;-)  But here are my general
thoughts on the matter, FWIW.
___


1. Keyboard keys are scarce.  Many are already "taken"
by default by Emacs.  (Yes, of course, users and
libraries can always _override_ any default bindings.)

Some of the keys Emacs has "taken" could fruitfully
be revisited.

Some are easily repeatable keys that are bound by
default to nonrepeatable commands, i.e., commands
that it makes no sense to hold the key down to repeat.

Some are particularly easy/quick to type, and are
bound to commands that might not be used that often.

Some were perhaps taken only because a key seemed to
be free at the time (often long ago), regardless of
how much a default binding was needed.  (Recently F2
has come up, as having been sacrificed for the
relatively unused/not-so-useful `2C-*' commands.)

Any such keys could be looked at as keys we might
possibly want to "open up".

(And no, I'm not saying that there aren't other
things to take into account when deciding on a
default key binding.  Ease/speed of finger access,
for example.)


2. But what do we mean by "open up" or "free" a
default key binding?  _I_ mean free it for use by
users and 3rd-party libraries.  Have Emacs give it
up - let it go.

I don't mean for Emacs to just bind it to something
different by default.  That's _not_ freeing it up;
that's just rearranging.  Rearranging can be useful
sometimes, but it doesn't help with the problem of
Emacs binding too many keys by default.

Some here feel the pinch as Emacs not having enough
free keys to bind to more commands by default.  I
feel the problem is the opposite: the pinch is on
users and 3rd-party libraries, and Emacs is doing
the pinching.  Some here see a "free" key and want
to bind it by default, sometimes to their shiny
new command.


3. There's been a tendency recently to give Emacs
even more default key bindings.  Two cases come
to mind, both in 2020:

a. `C-x p' was taken by Emacs as a prefix key for
   `project.el' commands.
b. `C-x t' was taken by Emacs as a prefix key for
   `tabbar.el' commands.

Maybe those deserve prefix keys (?).  But you see
the tendency - less and less for users; more taken
by default bindings.

That's 2 excellent prefix keys just removed, in
effect, from the user/3rd-party space.  Poof!

For example, in my code I've used `C-x p' and
`C-x 4 p' as prefix keys for Bookmark+ for over
10 years, but I changed them (`C-x x', `C-x 4 x')
in 2020 because of (a).

(I have 86 key bindings organized onto those two
prefix keys - some on submaps: `C-x x a',
`C-x x b', `C-x x c', `C-x x t', `C-x x t +',...)

And I've used `C-x t' as a suggested prefix key
for library DoReMi for 16 years.  But I'll have to
change that in 2020 because of (b).

I pointed this out here at the time.  Response was,
in effect, "tough tiddlywinks".  OK.

https://lists.gnu.org/archive/html/emacs-devel/2019-12/msg00085.html

The point is that instead of Emacs trying to reserve
_more_ keys as free for its users (without having to
override default bindings), the impetus here has
been to sacrifice ever more keys to default bindings.


4. When Emacs does decide to bind a key by default,
these two general guidelines (at least) should be
considered, IMO.  (This applies to rearranging, as
well as to binding a previously free key.)

1. Save naturally repeatable keys for commands that
   can be repeated, i.e., commands that it makes
   sense to be able to hold down a key to repeat.

2. Save some keys for prefix keys, as opposed to
   just sacrificing them for a single command.  A
   prefix key gives you a whole keyboard of
   possibilities for a single key.  Think of all
   the mileage we get out of the prefix key `C-x'!
   Of course, adding a prefix key makes a key
   sequence longer, more complex.  Tradeoff.


___________________

That point (#4) and the rest of this message
were part of a post of mine to help-gnu-emacs
on 9/23/2020, on pretty much this same topic:

https://lists.gnu.org/archive/html/help-gnu-emacs/2020-09/msg00273.html

I tend to define lots of keys for features I write,
and put them, by groups, on their own keymaps, and
then put those keymaps on prefix keys.

Even if such a prefix key appears complicated or
slow, the fact of using a separate keymap means
that a user can easily put it on a different,
shorter key, or remap it to a more global keymap.

Now imagine that keys aren't reserved by Emacs this
way - repeatable keys for repeatable commands, and
some keys available to be used as prefix keys.

Imagine if Emacs just predefined `C-x' for a single
command (e.g. `cut').  _Zillions_ of keys bound now
under `C-x' would be sacrificed.

At the very least, when a new key is decided to be
sacrificed by default (vanilla Emacs), it had better
be bound to a repeatable command, not one (such as
`cut') that it makes no sense to repeat.

And even a repeatable key is a sacrifice - consider
if `C-x' were bound to, say, `forward-word'.
Repeatable, yes, but think of all the bindings now
under `C-x' that would be lost.

Keyboard keys are precious - scarce.  Too many have
already been sacrificed to default bindings, IMO.
Sure, any user or library can redefine any keys.
But once blessed as a default vanilla-Emacs key
binding, a key is, for practical purposes, kinda
off limits for a library.

The point is that (1) it's easy to move a keymap
from one prefix key to another, and (2) there need
to be some prefix keys available to move maps to.

Eventually, I imagine (hope) that some simple,
repeatable keys that have been assigned default
Emacs bindings for commands that aren't repeatable,
or that aren't super useful, or that don't really
need a single-key binding, will be recycled and
put to better use: for repeatable commands, as
prefix keys, or just unbound by default and left
available for libraries.

No, I don't have particular suggestions, and no,
it's not urgent.

But consider `M-!', for example.  Sure, `!' is
mnemonic for shell.  But `M-!' is repeatable
(just hold it down), and it makes no sense to
repeat `shell-command'.  There are other default
key bindings like this - essentially wasted wrt
easy repetition.

Some nonrepeatable commands bound to repeatable
keys should be replaced by repeatable versions.
I do that for `C-a' and `C-e', for example, so
they're similar to `C-n' and `C-p' (repeatable).
That kind of change is minimal - it's the least
we can do to make things a little saner.

Take a look at `C-h b', and see which repeatable
keys are bound to nonrepeatable commands.  Not
too many, but there are some.

Even `C-w' is "wasted" on a nonrepeatable command.
Am I suggesting that `C-w' should not be bound by
default to `kill-region'?  Not really.  That's not
urgent, at least.  But hey, keys are limited - the
keyboard's a small planet. ;-)

And `beginning-of-buffer'.  That nonrepeatable
command's bound by default to two repeatable keys,
`M-<' and `C-home'.  Both mnemonic (good).  But...


[-- Attachment #2: Type: text/html, Size: 11442 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-02 22:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-02 18:14 Emacs default key bindings [was: Opening Up More Keymaps Re: Standardizing more key bindings?] Drew Adams
2020-10-02 19:21 ` Philip K.
2020-10-02 20:41   ` Drew Adams
2020-10-02 19:24 ` Ergus
2020-10-02 20:45   ` Drew Adams
2020-10-02 22:31   ` Philip K.
2020-10-02 22:50     ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2020-10-02 18:46 arthur miller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).