Discussion:
How to remember key-bindings?
(too old to reply)
Justin
2003-06-27 18:08:30 UTC
Permalink
Hi,

I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.

So I was wondering if anyone has a cunning way of remembering the (most
common) bindings - I'm guessing there must be a structure to the key
bindings - i.e what do all the C-x commands have in common? And the M-x?
Why is save file C-x C-s, yet insert file C-x i, why not C-x C-i? Why is
list buffers C-x C-b and select buffer C-x b?

Are these unreasonable questions!? I have the feeling there's something
obvious out there to explain all this but it's just remaining beyond my
grasp!


Thanks in advance,

Justin
David Masterson
2003-06-27 18:25:31 UTC
Permalink
Post by Justin
I use emacs kind of frequently, but I can never remember the key-bindings.
Take the in-built tutorial (C-h t).
--
David Masterson David DOT Masterson AT synopsys DOT com
Sr. R&D Engineer Synopsys, Inc.
Software Engineering Sunnyvale, CA
Justin
2003-06-27 18:54:04 UTC
Permalink
Post by David Masterson
Post by Justin
I use emacs kind of frequently, but I can never remember the
key-bindings.
Take the in-built tutorial (C-h t).
I've just looked through the tutorial again, but it doesn't explain *why*
the key-bindings are arranged as they are. I can use the help to remember a
specific keybinding by rote. What I'm looking for is a structure of some
sort that will help me remember the difference between, say, "C-x i" rather
than "C-x C-i" other than just by rote.
Barry Margolin
2003-06-27 19:18:30 UTC
Permalink
Post by Justin
Hi,
I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.
So I was wondering if anyone has a cunning way of remembering the (most
common) bindings - I'm guessing there must be a structure to the key
bindings - i.e what do all the C-x commands have in common? And the M-x?
Why is save file C-x C-s, yet insert file C-x i, why not C-x C-i? Why is
list buffers C-x C-b and select buffer C-x b?
The answers to most of these are simply that it's due to which commands
were introduced first. When new commands were added way back when, they
didn't want to cause incompatibility. So even though it would make logical
sense for insert-file to be C-x C-i, that sequence might have been in use
for something else, so C-x i was used instead.
Post by Justin
Are these unreasonable questions!? I have the feeling there's something
obvious out there to explain all this but it's just remaining beyond my
grasp!
It's kind of like spelling. Learn the general rules (like the pattern
C-<char> -> M-<char> for letters -> words) and then learn the exceptions.
--
Barry Margolin, ***@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
llewelly
2003-07-09 14:29:29 UTC
Permalink
Post by Barry Margolin
It's kind of like spelling. Learn the general rules (like the pattern
C-<char> -> M-<char> for letters -> words) and then learn the
exceptions.
And C-x <something> for x-tra long key sequences. :-)
That's the kind I was looking for! Any more 'grammar' rules of thumb?
Read the info pages. The info pages are good at grouping related
keys together. This makes it easy to see most of the general
rules. For example, use C-h i g (emacs) Registers to go to the
'Registers' node, and hit space a few times, keeping an eye out
for keybindings. Note most of the register related keys begin with
C-x r . Similarly, if you look up version control in info,
you'll see most version control keys begin with C-x v .

It is common for a key to use the first letter of some important
word from the command's name. Examples: C-f => forward-char ,
C-x r j => jump-to-register, but sometimes a weird choice is made,
like C-x r m => bookmark-set - which I remember by thinking of the
similarity between bookmarks and registers, and of the 'm' in
bookmark.
David Combs
2003-07-23 22:28:13 UTC
Permalink
Post by Barry Margolin
It's kind of like spelling. Learn the general rules (like the pattern
C-<char> -> M-<char> for letters -> words) and then learn the exceptions.
Well, p and n are often associated with going
backwards and forwards through something.

"a" and "e" often mean beginning and end (ditto
for lynx: ^A and ^E go to the beginning and end
of a "page" (might be 100 screens long))

Do C-h m and also C-h b, and save-away those displays
for printing-out and keeping around.

(Do those help-cmds when in a buffer of a "mode"
that you USUALLY use -- so the results will
be maximally applicable to your own use).

Hope this helps.

David
Andy Sawyer
2003-07-25 19:03:08 UTC
Permalink
In article <bfn25t$npo$***@reader1.panix.com>,
on Wed, 23 Jul 2003 22:28:13 +0000 (UTC),
Post by David Combs
Post by Barry Margolin
It's kind of like spelling. Learn the general rules (like the
pattern C-<char> -> M-<char> for letters -> words) and then learn
the exceptions.
Well, p and n are often associated with going
backwards and forwards through something.
The hint there being "*p*revious" and "*n*ext".
Post by David Combs
"a" and "e" often mean beginning and end (ditto
for lynx: ^A and ^E go to the beginning and end
of a "page" (might be 100 screens long))
"a" being the first letter of the alphabet¹ and "*e*nd".
("B" was already in use for "*b*ackward")

And of course, there's also f - "*f*orward".

Regards,
'(andys)

Footnotes:
¹ At least, I've always assumed that was the logic :)
--
"Light thinks it travels faster than anything but it is wrong. No matter
how fast light travels it finds the darkness has always got there first,
and is waiting for it." -- Terry Pratchett, Reaper Man
Kai Großjohann
2003-06-27 19:41:19 UTC
Permalink
Post by Justin
So I was wondering if anyone has a cunning way of remembering the (most
common) bindings - I'm guessing there must be a structure to the key
bindings - i.e what do all the C-x commands have in common? And the M-x?
Why is save file C-x C-s, yet insert file C-x i, why not C-x C-i? Why is
list buffers C-x C-b and select buffer C-x b?
The C-<something> bindings normally do quite basic things on a
syntactic of character level. (Exception C-x and C-c which serve as
prefixes to longer sequences.)

M-<something> works on a more semantic level -- words instead of
characters, or sentences instead of lines. (Compare C-a/M-a,
C-e/M-e, C-k/M-k.)

There is a strong relationship between TAB and indenting. That's why
C-x TAB indents. (TAB and C-i are the same. Also RET = C-m and LFD
= C-j.)

I guess that C-x C-f is not C-x f because C-x C-f needs to be typed
often.

C-x b and C-x C-b are similar bindings because they have a similar
purpose -- selecting a buffer. While C-x C-b is faster to type, C-x
b is usually followed by normal characters (the buffer name), and so
it is not a disadvantage that the second character is without C-.

Note that C-x C-s and C-x s are also related, where C-x s is typed
less often and does more, so it's not so important that it is quickly
typable.
--
~/.signature
Brian Masinick
2003-06-27 20:16:22 UTC
Permalink
Post by Justin
Hi,
I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.
So I was wondering if anyone has a cunning way of remembering the (most
common) bindings - I'm guessing there must be a structure to the key
bindings - i.e what do all the C-x commands have in common? And the M-x?
Why is save file C-x C-s, yet insert file C-x i, why not C-x C-i? Why is
list buffers C-x C-b and select buffer C-x b?
Are these unreasonable questions!? I have the feeling there's something
obvious out there to explain all this but it's just remaining beyond my
grasp!
Thanks in advance,
Well, Justin, I'll give you my observations about what I think was
intended when the default key bindings were created, point out to you
that you can always change key bindings (be careful, though, if you
redefine either C-c or C-x, these have multiple key sequences
associated with them, so you'd have to change a lot of things or lose
a lot of bindings).

In any case, I believe that the original rationale was to get as many
of the key and cursor movement functions on the primary control keys
as possible, associate small movements with the control keys, and
large movements of the same type with the M-x (either Alt or Esc,
depending on what you have available).

C-x is a prefix for the range of extended commands. You might
question why exiting takes multiple keystrokes? Well, you can
redefine it in any way that you want, but by default, the designers
tended to remain in editing sessions indefinitely (days, weeks,
months, ... longer?) and switch between multiple editing buffers to
edit files and perform a wide variety of other tasks.

C-a sends you to the beginning of the current line, M-a sends you to
the beginning of the sentence or to the previous beginning of a
sentence.

C-n sends you to the next line, C-p sends you to the previous line.
C-f sends you forward one character, C-b sends you back one character.

Similarly, M-f sends you forward one word and M-b sends you back one
word.

Each of these commands can be modified by a prefix, which has the
effect of either adding or multiplying to the amount of movement.

For example, C-u C-f will move you forward four characters and C-u C-u
C-f will move you forward sixteen characters, and M-25 C-f will move
you forward 25 characters. These modifiers can be used on most
commands and will have the effect of moving or modifying either
forward or backward, or repeating an operation a specified number of
times.

So the mneumonic f usually means forward, the mneumonic b usually
means backward, the mneumonic n usually means next and the mneumonic p
usually means previous.

Like most editors, after a while, you start running out of meaningful
mneumonics, so you do the best you can, either create a NEW mneumonic,
or choose something that's logicallly near other key selections on the
keyboard.

The vi editor has some really strange mneumonics to represent cursor
movement, yet they turn out to be very convenient once you get used to
them. Emacs chose a different way, some like it,.some hate it. Emacs
also gives you numerous choices, so if you don't like the defaults,
there are all kinds of Elisp programs out there that map all kinds of
different key sequences to match people's interests and preferences -
including at least three different Vi emulators that I can think of,
offhand.

I really think that the tutorial goes into much more detail than I
could possibly explain here, and between the C-h t tutorial and the
info pages (C-h i), you'll get a much more complete and accurate
description than anything I've attempted to extemporaneously explain
here. I do hope that I've whetted your appetite and provided some
possible explanations for the way things are. However, I am not the
definitive source of information on any of this, the resources that
come right with the software ARE those resource. I'm just hoping to
get you started, and hopefully I've been accurate enough not to steer
you the wrong way --- but if I have erred in any way, please refer to
the info and tutorial pages, plus apropos (C-h a) and all the other
useful tools that are available.

Best wishes as you embark on the journey!

--
Brian W. Masinick
mailto:***@yahoo.com
Sailesh Krishnamurthy
2003-06-28 20:22:38 UTC
Permalink
Try installing suggbind.el from Noah Friedman

;; $Date: 1997/05/18 10:27:40 $|$Revision: 1.5 $|~/misc/suggbind.el.gz|

;; $Id: suggbind.el,v 1.5 1997/05/18 10:27:40 friedman Exp $

;;; Commentary:

;; Emacs 19.30 changed the behavior of execute-extended-command (i.e. the
;; command which lets you run other commands by typing ``M-x foo'' so that
;; if the variable `suggest-key-bindings' is set, it prints the keybinding
;; (if any) of the command to help you learn shortcuts.

;; Unfortunately, while that behavior is useful, it is also annoying
;; because you have to wait for the message to time out before the command
;; is actually executed. Hinting at keybindings should be instructive but
;; not force you to use them just to avoid the delay nuisance; at the same
;; time you can't make the delay so short that you have no time to read the
;; message.

;; This package provides alternate behavior: it suggests key bindings
;; *after* the command has completed, and even then only if the user is
;; idle for at least a second (or whatever is set via the variable
;; `suggbind-suggest-key-bindings'). Emacs 20.1 and later have this
;; behavior too, but there are still some other differences.
--
Pip-pip
Sailesh
http://www.cs.berkeley.edu/~sailesh
Jesper Harder
2003-06-30 23:16:29 UTC
Permalink
Post by Justin
I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.
<plug>

;;; keywiz.el --- Emacs key sequence quiz

;; Location: <http://purl.org/harder/>
;; Keywords: games, keyboard

;;; Commentary:

;; keywiz.el drills you about Emacs key-bindings. You're presented
;; with the name of a command and the docstring, and then prompted for
;; the correct key sequence. You'll earn one point for each correct
;; answer during the time limit.
;;
;; Invoke with `M-x keywiz'. A prefix argument will force keywiz to
;; rescan the key-binding -- this is useful if you want to include
;; bindings from a different mode.
;;
;; Are you a true Emacs key-binding wizard or just a poor vi looser?
;; Get your foot-pedals in position and see how many key-bindings you
;; can remember in two minutes.
;;
;; Forget about your Nethack high-score -- surely, knowing how to
;; wield the powers of the One True Editor at your fingertips will
;; earn you more bragging rights than ascending bare-footed in some
;; silly game with vi-keybindings :-)

</plug>
llewelly
2003-07-03 17:34:28 UTC
Permalink
Post by Jesper Harder
Post by Justin
I use emacs kind of frequently, but I can never remember the key-bindings.
If I'm using a X version I can do most of what I want with the menu, but
running as text only is not so easy.
<plug>
;;; keywiz.el --- Emacs key sequence quiz
;; Location: <http://purl.org/harder/>
[snip]

hmm... didn't find it there.

Found it here: http://www.ifa.au.dk/~harder/keywiz.el
Loading...