Subject: Re: bug#9751: 23.3; Alternative Keyboard Feature/Bug

From: Juri Linkov <[email-masked]>
Date: Thu, 12 Jan 2012 02:35:54 +0200

>>>> What is the way in emacs to alias Ctr-chi to Ctr-x ?
>>> I'd do it in input-decode-map:
>>> (define-key input-decode-map [?\C-χ] [?\C-x])
>>> (define-key input-decode-map [?\C-ψ] [?\C-s])
>> The problem is that this method doesn't work for self-inserting characters,
>> i.e. to be able to handle keybindings that contain characters without
>> modifiers like e.g. `C-x b' we can't use
>>   (define-key input-decode-map [?β] [?b])
>
> That's a problem indeed.  I guess we can use function-key-map instead, tho.

There is a serious problem with using `function-key-map'.  The users who
encrypt gpg files in Emacs, can't decrypt them using command line tools.

The reason is that `epa-encrypt-file' uses `read-passwd' to read
a passphrase for symmetric encryption, but some keys are translated
according to `function-key-map'.

Trying to decrypt the file with command line tools using the same
passphrase fails because command line tools don't use `function-key-map'
translation for passphrases.

This problem can be fixed with the following patch:

=== modified file 'lisp/subr.el'
--- lisp/subr.el	2012-01-07 19:50:04 +0000
+++ lisp/subr.el	2012-01-12 00:34:03 +0000
@@ -2092,6 +2092,7 @@ (defun read-passwd (prompt &optional con
 	    (echo-keystrokes 0)
 	    (cursor-in-echo-area t)
 	    (message-log-max nil)
+	    (local-function-key-map nil)
 	    (stop-keys (list 'return ?\r ?\n ?\e))
 	    (rubout-keys (list 'backspace ?\b ?\177)))
 	(add-text-properties 0 (length prompt)