emacs-devel
[Top][All Lists]
Advanced

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

Re: M-g in dired


From: Stefan Monnier
Subject: Re: M-g in dired
Date: Thu, 03 Nov 2005 10:03:18 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> But in dired-mode-map, where "C-x `" is undefined, lookup-key
> currently returns:

>   (lookup-key dired-mode-map "\C-x") => nil
>   (lookup-key dired-mode-map "\C-x`") => 1

> The return value `1' of the last expression seems wrong.

No, it is correct.  `lookup-key' only looks at the keymap passed as argument
and doesn't (and shouldn't) try and guess which other keymaps might/will be
active together with this keymap.

> This docstring is not very clear.  The documentation in the Emacs Lisp
> is better:

>   If the string or vector KEY is not a valid key sequence according to
>   the prefix keys specified in KEYMAP, it must be "too long" and have
>   extra events at the end that do not fit into a single key sequence.
>   Then the value is a number, the number of events at the front of KEY
>   that compose a complete key.

> For the case of dired-mode-map where lookup-key returns 1 for "\C-x`",
> 1 is not a number of events at the front of "\C-x`" that compose
> a complete key, because "C-x" alone is not a valid key in dired-mode-map.

It doesn't say "valid key" it says "valid key sequence".  "C-x" is a valid
key sequence in this context.  It is not bound to anything, but it is
a valid sequence.  C-x ` is not a valid sequence on the other hand, because
read-key-sequence would have immediately stopped after C-x.


        Stefan




reply via email to

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