Subject: Re: bug#7803: 23.1; Need better definition of vector notation in define-key

From: Larry Evans <[email-masked]>
Date: Fri, 07 Jan 2011 21:08:09 -0600

On 01/07/11 19:50, Glenn Morris wrote:
> Larry Evans wrote:
> 
>> Ah, so when it says:
>>
>>   If KEY is `[t]', this sets the default binding in KEYMAP.
>>
>> it means:
> 
> You're overthinking it. It means literally what it says: a vector with
> a single element `t'. Not a vector with any other contents.
> `t' in Emacs documentation always means the special symbol `t', for truth.

Ah. OK.  So if the KEY in

  (define-key KEYMAP KEY BINDING)

is `[t]', then BINDING is ignored, and, I guess, the default binding for
*all* keys in KEYMAP are set to the default binding?  I guess the
"default binding" is self-insert, IOW.

OOPS, now.  I finally went to help, entered define-key, and got:

> define-key is a built-in function in `C source code'.
> 
> (define-key keymap key def)
> 
> In keymap, define key sequence key as def.
> keymap is a keymap.
> 
> key is a string or a vector of symbols and characters meaning a
> sequence of keystrokes and events.  Non-ASCII characters with codes
> above 127 (such as ISO Latin-1) can be included if you use a vector.
> Using [t] for key creates a default definition, which applies to any
> event type that has no other definition in this keymap.

which finally cleared things up.  This tells me that after:

  (define KEYMAP [t] DEFAULT_BINDING)

then any key, KEY, which has *not* occurred in a call:

  (define-key KEYMAP KEY def)

for some value of def, has the DEFAULT_BINDING in KEYMAP.

Is that right?

> 
> Rather than reading the Lispref, the Emacs manual offers a better
> introduction to key bindings for the purposes of user customization.
> 
> (I admit I couldn't see a clear mention of "S-" = "shift" there, though.)
> 

After fishing around the manual, I found it in the info node, "Other
Char Bits" which contains:

  The Lisp syntax for the shift bit is `\S-'; thus, `?\C-\S-o' or
  `?\C-\S-O' represents the shifted-control-o character.

The ? was a bit  mysterious at first, but more fishing showed
me what it meant, but I don't remember where that info node is.