opensubscriber
   Find in this group all groups
 
Unknown more information…

e : emacs-devel@gnu.org 14 August 2012 • 8:02AM -0400

bug#12022: [PATCH] Unable to use anonymous functions for Key Translations
by Barry OReilly

REPLY TO AUTHOR
 
REPLY TO GROUP




> Using an anonymous function to translate keys as described in the Elisp
manual at
http://www.gnu.org/software/emacs/manual/html_node/elisp/Translation-Keymaps.htmldoes
not work as expected.
>
> Using a named function to map C-e to C-c, the Key Translation is
successful:
>   (progn (fset 'foo (lambda (prompt) (kbd "C-c")))
>          (define-key key-translation-map (kbd "C-e") 'foo))
>
> Using an anonymous function for another keymap binds C-e to the
lambda-defined command.
>   (define-key global-map
>               (kbd "C-e")
>               (lambda () (interactive) (message "Inside C-e's lambda")))
>
> But using an anonymous function for key-translation-map does not change
behavior of inputting C-e:
>   (define-key key-translation-map
>               (kbd "C-e")
>               (lambda (prompt) (kbd "C-c")))
>
> I find no reason why the last Elisp shouldn't define a Key Translation.
The Elisp manual section on Anonymous Functions states "Anonymous functions
are valid wherever function names are."  (
http://www.gnu.org/software/emacs/manual/html_node/elisp/Anonymous-Functions.html)

Hi,
I found where the definition of a key translation is called, and made a
patch.  The quoted test case works correctly now.  Is the change ok?

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.