emacs-devel
[Top][All Lists]
Advanced

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

A bug, I think, in key-binding


From: David Kastrup
Subject: A bug, I think, in key-binding
Date: Wed, 09 Aug 2006 00:47:28 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hi, we have

    read-key-sequence is a built-in function in `src/keyboard.c'.
    (read-key-sequence PROMPT &optional CONTINUE-ECHO DONT-DOWNCASE-LAST
    CAN-RETURN-SWITCH-FRAME COMMAND-LOOP)

    Read a sequence of keystrokes and return as a string or vector.
    The sequence is sufficient to specify a non-prefix command in the
    current local and global maps.

    [...]

    If the key sequence starts with a mouse click, then the sequence is read
    using the keymaps of the buffer of the window clicked in, not the buffer
    of the selected window as normal.

    [...]

`read-key-sequence', although the DOC string does not mention it, will
also substitute any mouse-activated maps for the buffer-local maps, if
they are present and a click event is used.

But if we take a look at `key-binding':

    key-binding is a built-in function in `src/keymap.c'.
    (key-binding KEY &optional ACCEPT-DEFAULT NO-REMAP)

    Return the binding for command KEY in current keymaps.
    KEY is a string or vector, a sequence of keystrokes.

    [...]

we will find that the same expression "current keymaps" suddenly fails
to include mouse-activated maps even for click events.

As a result, you can't reliably feed the output of `read-key-sequence'
into `key-binding': the meaning differs.

I think this is a mistake.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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