GNU bug report logs -
#12022
Unable to use anonymous functions for Key Translations
Previous Next
Reported by: Barry OReilly <gundaetiapo <at> gmail.com>
Date: Sun, 22 Jul 2012 03:00:02 UTC
Severity: normal
Tags: patch
Fixed in version 24.3
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
> 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?
[Message part 2 (text/html, inline)]
[lambdaKeyTranslation.txt (text/plain, attachment)]
This bug report was last modified 13 years and 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.