[Top][All Lists]

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

bug#12022: [PATCH] Unable to use anonymous functions for Key Translation

From: Barry OReilly
Subject: bug#12022: [PATCH] Unable to use anonymous functions for Key Translations,
Date: Sat, 11 Aug 2012 22:45:47 -0400

> 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.html does 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 )

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?

Attachment: lambdaKeyTranslation.txt
Description: Text document

reply via email to

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