GNU bug report logs - #70139
29.3.50; key-translate does not support all keyboard-translate usages

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Robert Pluim <rpluim@HIDDEN>; dated Tue, 2 Apr 2024 09:52:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 9 Apr 2024 11:14:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 09 07:14:53 2024
Received: from localhost ([127.0.0.1]:48468 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ru9RE-0000Wq-Th
	for submit <at> debbugs.gnu.org; Tue, 09 Apr 2024 07:14:53 -0400
Received: from mout02.posteo.de ([185.67.36.66]:33177)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1ru9RC-0000Vl-Pm
 for 70139 <at> debbugs.gnu.org; Tue, 09 Apr 2024 07:14:51 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 3D2A8240104
 for <70139 <at> debbugs.gnu.org>; Tue,  9 Apr 2024 13:14:36 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712661276; bh=im9FGk0OxfbKvEmQy95OU0cwFVZxiKR/qpBgrn3/mus=;
 h=Content-Type:Message-ID:Date:MIME-Version:Subject:To:Cc:From:
 From;
 b=c7SKOXrYxulHRiHqioDW25eChsvZN1PzhKeILL+NZU67GdJAtT3WGqgy3F1mxB7tS
 /s1U+7V7fdBVSYk89FdoJUfGu0ca0p6g/+FPNMZEte59Yvt4lXl0XWYujVkuc+seZS
 lAnIZ8IRAdA6w7wBqs47XzTb+RMeqsDmnf7mz2T1LhtOc+0g9YU2NRQf9Zhmwguksd
 cwPwu9ZOhNR+TCxPRwK9eYNQ7eORxRjTzjv3+1RJVOs0mzq8f9KTjP8O6OTvihXi5p
 CB63+ajAsLxUSpRVmVFhTPt05B+4S4LVizOLrf3YNikQN2dSlDd2NCM4LvCbajkZ9R
 0ZmARM5sJIzSA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VDNdl1rNZz6tvb;
 Tue,  9 Apr 2024 13:14:34 +0200 (CEST)
Content-Type: multipart/mixed; boundary="------------mN4fmpNvgLnf0zMcU3BMoCuH"
Message-ID: <68b807b9-1fa4-4430-87f4-e684a50f0bbe@HIDDEN>
Date: Tue,  9 Apr 2024 11:14:34 +0000
MIME-Version: 1.0
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
To: Stefan Monnier <monnier@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
 <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
 <jwv34s0lrre.fsf-monnier+emacs@HIDDEN> <m27chamn8b.fsf@HIDDEN>
 <m2le5ql89m.fsf@HIDDEN> <jwvle5pz10f.fsf-monnier+emacs@HIDDEN>
Content-Language: en-US
From: Charalampos Mitrodimas <charmitro@HIDDEN>
In-Reply-To: <jwvle5pz10f.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

This is a multi-part message in MIME format.
--------------mN4fmpNvgLnf0zMcU3BMoCuH
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit


On 4/7/24 17:45, Stefan Monnier wrote:
>> +            (lambda (form) (keymap--compile-check from (and to to)) form)))
>                                                            ^^^^^^^^^^^
>                                                            ??
>
>>     (keymap--check from)
>> -  (keymap--check to)
>> -  (or (char-table-p keyboard-translate-table)
>> -      (setq keyboard-translate-table
>> -            (make-char-table 'keyboard-translate-table nil)))
>> -  (aset keyboard-translate-table
>> -        (aref (key-parse from) 0)
>> -        (aref (key-parse to) 0)))
>> +  (when to
>> +    (keymap--check to))
>> +  (let ((from-key (key-parse from))
>> +        (to-key (and to (key-parse to))))
>> +    (when (> (length from-key) 1)
>> +      (error "FROM key %s is not a single key" from))
>> +    (when (and to (> (length to-key) 1))
>> +      (error "TO key %s is not a single key" to))
> I'd check `=` while at it (if length is 0 the error is caught by
> `aref`, but it's a less helpful error).
>
>
>          Stefan

Updated & attached.

--
Charalampos

--------------mN4fmpNvgLnf0zMcU3BMoCuH
Content-Type: text/x-patch; charset=UTF-8;
 name="0001-Improve-key-translate-to-support-removing-translatio.patch"
Content-Disposition: attachment;
 filename*0="0001-Improve-key-translate-to-support-removing-translatio.pa";
 filename*1="tch"
Content-Transfer-Encoding: base64

RnJvbSAzMGNiZTc3MjJhNjc3YTUzYWU5YzlmNjZiMTMxNTMyNzUzMjRhZGM2IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBDaGFyYWxhbXBvcyBNaXRyb2RpbWFzIDxjaGFybWl0
cm9AcG9zdGVvLm5ldD4KRGF0ZTogVHVlLCAyIEFwciAyMDI0IDE5OjAyOjQ2ICswMDAwClN1
YmplY3Q6IFtQQVRDSF0gSW1wcm92ZSBrZXktdHJhbnNsYXRlIHRvIHN1cHBvcnQgcmVtb3Zp
bmcgdHJhbnNsYXRpb25zCgpUaGlzIHBhdGNoIGVuaGFuY2VzIHRoZSBrZXktdHJhbnNsYXRl
IGZ1bmN0aW9uIHRvIGFsbG93IHJlbW92aW5nCmtleWJvYXJkIHRyYW5zbGF0aW9ucyBieSBw
YXNzaW5nIG5pbCBhcyB0aGUgc2Vjb25kIGFyZ3VtZW50IChUTykuCgpJZiBUTyBpcyBuaWws
IGFueSBleGlzdGluZyB0cmFuc2xhdGlvbiBmb3IgdGhlIEZST00ga2V5IHdpbGwgYmUgcmVt
b3ZlZC4KVGhlIGNvbXBpbGVyIG1hY3JvIGlzIHVwZGF0ZWQgdG8gb25seSBjaGVjayBUTyB3
aGVuIGl0IGlzIG5vbi1uaWwuCgpUaGlzIGNoYW5nZSBtYWtlcyBrZXktdHJhbnNsYXRlIG1v
cmUgY29uc2lzdGVudCB3aXRoIHRoZSBiZWhhdmlvciBvZgprZXlib2FyZC10cmFuc2xhdGUs
IHByb3ZpZGluZyBhIHdheSB0byByZW1vdmUgdHJhbnNsYXRpb25zIHdpdGhvdXQKaGF2aW5n
IHRvIHNwZWNpZnkgdGhlIHNhbWUga2V5IGZvciBib3RoIEZST00gYW5kIFRPLgoKVGhlIGRv
Y3VtZW50YXRpb24gc3RyaW5nIGlzIHVwZGF0ZWQgdG8gcmVmbGVjdCB0aGUgbmV3IGJlaGF2
aW9yLgoKKiBsaXNwL2tleW1hcC5lbCAoa2V5LXRyYW5zbGF0ZSk6IHN1cHBvcnQgcmVtb3Zp
bmcgdHJhbnNsYXRpb25zIGJ5CiAgcGFzc2luZyBuaWwgYXMgdGhlIHNlY29uZCBhcmd1bWVu
dCAoVE8pLiBBbHNvIHRocm93IGVycm9yIGlmIG11bHRpcGxlCiAgaXRlbXMgcGFzc2VkLiAo
QnVnIzcwMTM5KQotLS0KIGxpc3Ava2V5bWFwLmVsIHwgMzMgKysrKysrKysrKysrKysrKysr
KysrKysrLS0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgMjQgaW5zZXJ0aW9ucygrKSwgOSBk
ZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9saXNwL2tleW1hcC5lbCBiL2xpc3Ava2V5bWFw
LmVsCmluZGV4IGIyYjQ3NWM3ZDcxLi41MWRmYmY0NWQyNCAxMDA2NDQKLS0tIGEvbGlzcC9r
ZXltYXAuZWwKKysrIGIvbGlzcC9rZXltYXAuZWwKQEAgLTM3OSwyMCArMzc5LDM1IEBAIGtl
eS12YWxpZC1wCiAKIChkZWZ1biBrZXktdHJhbnNsYXRlIChmcm9tIHRvKQogICAiVHJhbnNs
YXRlIGNoYXJhY3RlciBGUk9NIHRvIFRPIG9uIHRoZSBjdXJyZW50IHRlcm1pbmFsLgorCiBU
aGlzIGZ1bmN0aW9uIGNyZWF0ZXMgYSBga2V5Ym9hcmQtdHJhbnNsYXRlLXRhYmxlJyBpZiBu
ZWNlc3NhcnkKIGFuZCB0aGVuIG1vZGlmaWVzIG9uZSBlbnRyeSBpbiBpdC4KIAotQm90aCBG
Uk9NIGFuZCBUTyBzaG91bGQgYmUgc3BlY2lmaWVkIGJ5IHN0cmluZ3MgdGhhdCBzYXRpc2Z5
IGBrZXktdmFsaWQtcCcuIgorQm90aCBGUk9NIGFuZCBUTyBzaG91bGQgYmUgc3BlY2lmaWVk
IGJ5IHN0cmluZ3MgdGhhdCBzYXRpc2Z5IGBrZXktdmFsaWQtcCcuCitJZiBUTyBpcyBuaWws
IHJlbW92ZSBhbnkgZXhpc3RpbmcgdHJhbnNsYXRpb24gZm9yIEZST00uIgogICAoZGVjbGFy
ZSAoY29tcGlsZXItbWFjcm8KLSAgICAgICAgICAgIChsYW1iZGEgKGZvcm0pIChrZXltYXAt
LWNvbXBpbGUtY2hlY2sgZnJvbSB0bykgZm9ybSkpKQorICAgICAgICAgICAgKGxhbWJkYSAo
Zm9ybSkgKGtleW1hcC0tY29tcGlsZS1jaGVjayBmcm9tIChpZiB0byB0byBuaWwpKSBmb3Jt
KSkpCiAgIChrZXltYXAtLWNoZWNrIGZyb20pCi0gIChrZXltYXAtLWNoZWNrIHRvKQotICAo
b3IgKGNoYXItdGFibGUtcCBrZXlib2FyZC10cmFuc2xhdGUtdGFibGUpCi0gICAgICAoc2V0
cSBrZXlib2FyZC10cmFuc2xhdGUtdGFibGUKLSAgICAgICAgICAgIChtYWtlLWNoYXItdGFi
bGUgJ2tleWJvYXJkLXRyYW5zbGF0ZS10YWJsZSBuaWwpKSkKLSAgKGFzZXQga2V5Ym9hcmQt
dHJhbnNsYXRlLXRhYmxlCi0gICAgICAgIChhcmVmIChrZXktcGFyc2UgZnJvbSkgMCkKLSAg
ICAgICAgKGFyZWYgKGtleS1wYXJzZSB0bykgMCkpKQorICAod2hlbiB0bworICAgIChrZXlt
YXAtLWNoZWNrIHRvKSkKKyAgKGxldCAoKGZyb20ta2V5IChrZXktcGFyc2UgZnJvbSkpCisg
ICAgICAgICh0by1rZXkgKGFuZCB0byAoa2V5LXBhcnNlIHRvKSkpKQorICAgIChjb25kCisg
ICAgICgoPSAobGVuZ3RoIGZyb20ta2V5KSAwKQorICAgICAgKGVycm9yICJGUk9NIGtleSBp
cyBlbXB0eSIpKQorICAgICAoKD4gKGxlbmd0aCBmcm9tLWtleSkgMSkKKyAgICAgIChlcnJv
ciAiRlJPTSBrZXkgJXMgaXMgbm90IGEgc2luZ2xlIGtleSIgZnJvbSkpKQorICAgIChjb25k
CisgICAgICgoYW5kIHRvICg9IChsZW5ndGggdG8ta2V5KSAwKSkKKyAgICAgIChlcnJvciAi
VE8ga2V5IGlzIGVtcHR5IikpCisgICAgICgoYW5kIHRvICg+IChsZW5ndGggdG8ta2V5KSAx
KSkKKyAgICAgIChlcnJvciAiVE8ga2V5ICVzIGlzIG5vdCBhIHNpbmdsZSBrZXkiIHRvKSkp
CisgICAgKG9yIChjaGFyLXRhYmxlLXAga2V5Ym9hcmQtdHJhbnNsYXRlLXRhYmxlKQorICAg
ICAgICAoc2V0cSBrZXlib2FyZC10cmFuc2xhdGUtdGFibGUKKyAgICAgICAgICAgICAgKG1h
a2UtY2hhci10YWJsZSAna2V5Ym9hcmQtdHJhbnNsYXRlLXRhYmxlIG5pbCkpKQorICAgIChh
c2V0IGtleWJvYXJkLXRyYW5zbGF0ZS10YWJsZQorICAgICAgICAgIChhcmVmIGZyb20ta2V5
IDApCisgICAgICAgICAgKGFuZCB0byAoYXJlZiB0by1rZXkgMCkpKSkpCiAKIChkZWZ1biBr
ZXltYXAtbG9va3VwIChrZXltYXAga2V5ICZvcHRpb25hbCBhY2NlcHQtZGVmYXVsdCBuby1y
ZW1hcCBwb3NpdGlvbikKICAgIlJldHVybiB0aGUgYmluZGluZyBmb3IgY29tbWFuZCBLRVkg
aW4gS0VZTUFQLgotLSAKMi4zOS4yCgo=

--------------mN4fmpNvgLnf0zMcU3BMoCuH--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 7 Apr 2024 14:45:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 07 10:45:44 2024
Received: from localhost ([127.0.0.1]:44301 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rtTmB-0000jv-NM
	for submit <at> debbugs.gnu.org; Sun, 07 Apr 2024 10:45:43 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rtTmA-0000jk-GD
 for 70139 <at> debbugs.gnu.org; Sun, 07 Apr 2024 10:45:42 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 43E361000FC;
 Sun,  7 Apr 2024 10:45:30 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1712501129;
 bh=IJAafrJ7vyBjKzCeaU5rXNqtl7x8TqkKMJRKl1Q25KQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=J0gbxI01bUMw8AzniLryQZN/r1FO/HR3Hu8YegOJ/1ide1/YUebeLKU3qlugrTzRJ
 yDLm0agfD1rN3b1sW5cf9fxpC0TRw3T3ywrypFTWNUKF0IFhSE08DzkNHBl4f09nkG
 2rVpkGtz//9IovxafoL9qrv0TFxhNdJWoE+aUlTnfVh7JDcU8G9jQ3vvWpTXdSBoPC
 KLc/GmRTrIO0hdoAvPL5GEhRy64LgiRtlSoqQMEMEZ1B6LPIz+wfQiu7PwYSWEEOOy
 9DsYCpBwNT9fI8kALs5M8cg8KwpcbRHPlCaG9TriV4qIP61oDcMWMk1MUcLfRQ5pbH
 w8oaKDIsY0PGA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3DC1A10004A;
 Sun,  7 Apr 2024 10:45:29 -0400 (EDT)
Received: from alfajor (unknown [45.72.201.215])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 152231201BF;
 Sun,  7 Apr 2024 10:45:29 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Charalampos Mitrodimas <charmitro@HIDDEN>
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
In-Reply-To: <m2le5ql89m.fsf@HIDDEN> (Charalampos Mitrodimas's message of
 "Sat, 06 Apr 2024 17:18:29 +0000")
Message-ID: <jwvle5pz10f.fsf-monnier+emacs@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
 <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
 <jwv34s0lrre.fsf-monnier+emacs@HIDDEN> <m27chamn8b.fsf@HIDDEN>
 <m2le5ql89m.fsf@HIDDEN>
Date: Sun, 07 Apr 2024 10:45:28 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.021 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> +            (lambda (form) (keymap--compile-check from (and to to)) form)))
                                                          ^^^^^^^^^^^
                                                          ??

>    (keymap--check from)
> -  (keymap--check to)
> -  (or (char-table-p keyboard-translate-table)
> -      (setq keyboard-translate-table
> -            (make-char-table 'keyboard-translate-table nil)))
> -  (aset keyboard-translate-table
> -        (aref (key-parse from) 0)
> -        (aref (key-parse to) 0)))
> +  (when to
> +    (keymap--check to))
> +  (let ((from-key (key-parse from))
> +        (to-key (and to (key-parse to))))
> +    (when (> (length from-key) 1)
> +      (error "FROM key %s is not a single key" from))
> +    (when (and to (> (length to-key) 1))
> +      (error "TO key %s is not a single key" to))

I'd check `=` while at it (if length is 0 the error is caught by
`aref`, but it's a less helpful error).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 6 Apr 2024 17:18:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 06 13:18:48 2024
Received: from localhost ([127.0.0.1]:40900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rt9gl-0001c7-QO
	for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 13:18:48 -0400
Received: from mout01.posteo.de ([185.67.36.65]:38325)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rt9gh-0001bE-TQ
 for 70139 <at> debbugs.gnu.org; Sat, 06 Apr 2024 13:18:46 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 61D96240027
 for <70139 <at> debbugs.gnu.org>; Sat,  6 Apr 2024 19:18:31 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712423911; bh=Rhv1eQLrozNU0rDbfT84yuhOIVSrtAbtP9iKxighN7Q=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=P0T4OOe11jjlw4lrHpHdF94hjo8wf7bqGUBpbToYmnYCIRHNT1dkhwdc1Nc/fBuFw
 XvHoinLVHrhXQfWThHEpKUYD+ql3cmD3d5vpuNV9Y0rTlIf4ImHOSeB6JCz7EPhfmv
 ymwWrv9cmDBORRWKTQRDvwPV4yAy+KNFTYTff5YVoDp1X7xC5Zht4dSBcegXrT25k7
 HwILLzBjHtU/chlWkP8j6WsEv/g9JacD5SkFD7l5IRkM1O8YoTog4uUUQJnHqfXlnj
 Pj7sQDOVte9J0b9awupCfQvBjfA+z/VCRa5cxdh0tqsHm+pRrQiNBHzpaVAWTicP/r
 KArhboG3w/fyA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VBhs24t6jz9rxG;
 Sat,  6 Apr 2024 19:18:30 +0200 (CEST)
From: Charalampos Mitrodimas <charmitro@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
In-Reply-To: <m27chamn8b.fsf@HIDDEN> (Charalampos Mitrodimas's message of
 "Sat, 06 Apr 2024 17:09:56 +0000")
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
 <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
 <jwv34s0lrre.fsf-monnier+emacs@HIDDEN> <m27chamn8b.fsf@HIDDEN>
Date: Sat, 06 Apr 2024 17:18:29 +0000
Message-ID: <m2le5ql89m.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Charalampos Mitrodimas <charmitro@HIDDEN> writes:

> Stefan Monnier <monnier@HIDDEN> writes:
>
>>> Just to clarify, are you referring to something like this?
>>>
>>> =C2=A0=C2=A0=C2=A0 (key-translate "C-x" "C-z" "C-a")
>>
>> No, rather (key-translate "C-a C-z" "C-x b")
>>
>>
>>         Stefan
>
> Thanks for clarifying this! Updated patch attached.
>
> [2. patch --- text/x-patch; 0001-Improve-key-translate-to-support-removin=
g-translatio.patch]...

Apologies, wrong patch. Attaching the correct one :-)

--
Charalampos


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Improve-key-translate-to-support-removing-translatio.patch
Content-Description: patch

From 45fd8a776bd51117e9c14d5ce096b2121383795b Mon Sep 17 00:00:00 2001
From: Charalampos Mitrodimas <charmitro@HIDDEN>
Date: Tue, 2 Apr 2024 19:02:46 +0000
Subject: [PATCH] Improve key-translate to support removing translations

This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).

If TO is nil, any existing translation for the FROM key will be removed.
The compiler macro is updated to only check TO when it is non-nil.

This change makes key-translate more consistent with the behavior of
keyboard-translate, providing a way to remove translations without
having to specify the same key for both FROM and TO.

The documentation string is updated to reflect the new behavior.

* lisp/keymap.el (key-translate): support removing translations by
  passing nil as the second argument (TO). Also throw error if multiple
  items passed. (Bug#70139)
---
 lisp/keymap.el | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/lisp/keymap.el b/lisp/keymap.el
index 4bdf65d39fa..acff41a3786 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -382,17 +382,25 @@ key-translate
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it.
 
-Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
+Both FROM and TO should be specified by strings that satisfy `key-valid-p'.
+If TO is nil, remove any existing translation for FROM."
   (declare (compiler-macro
-            (lambda (form) (keymap--compile-check from to) form)))
+            (lambda (form) (keymap--compile-check from (and to to)) form)))
   (keymap--check from)
-  (keymap--check to)
-  (or (char-table-p keyboard-translate-table)
-      (setq keyboard-translate-table
-            (make-char-table 'keyboard-translate-table nil)))
-  (aset keyboard-translate-table
-        (aref (key-parse from) 0)
-        (aref (key-parse to) 0)))
+  (when to
+    (keymap--check to))
+  (let ((from-key (key-parse from))
+        (to-key (and to (key-parse to))))
+    (when (> (length from-key) 1)
+      (error "FROM key %s is not a single key" from))
+    (when (and to (> (length to-key) 1))
+      (error "TO key %s is not a single key" to))
+    (or (char-table-p keyboard-translate-table)
+        (setq keyboard-translate-table
+              (make-char-table 'keyboard-translate-table nil)))
+    (aset keyboard-translate-table
+          (aref from-key 0)
+          (and to (aref to-key 0)))))
 
 (defun keymap-lookup (keymap key &optional accept-default no-remap position)
   "Return the binding for command KEY in KEYMAP.
-- 
2.39.3 (Apple Git-146)


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 6 Apr 2024 17:10:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 06 13:10:16 2024
Received: from localhost ([127.0.0.1]:40896 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rt9YV-00011V-K7
	for submit <at> debbugs.gnu.org; Sat, 06 Apr 2024 13:10:16 -0400
Received: from mout02.posteo.de ([185.67.36.66]:42027)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rt9YS-00010Y-3v
 for 70139 <at> debbugs.gnu.org; Sat, 06 Apr 2024 13:10:13 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 40510240103
 for <70139 <at> debbugs.gnu.org>; Sat,  6 Apr 2024 19:09:59 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712423399; bh=ikTTudsVgGHovxpKmsZuDZae23wUu8iFFOf5FhCstXo=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=GS7QSkM+yd2TQVEDmTz++8hvcmWrcel4prkGsZKfGdNreBZ8lRtXN8aI5u2PEtU6y
 mfeNJenhIqIiJ+lJfg8rMxWE6hxr448oXEb7TDj7zM2vkKQrDJfpdGt+txGb7hNNx9
 Fy+8tfTmJKjKNp5KvVQ2JoiNHdVDd1xfC2d8ZOo5yjK33hgRDKDvil5rjHGpfzs1fg
 ruKFoDhzWit3/Bx2AtlX582vFimxYm0ant2L9ibinQYmJYV2NgnuWxsCWwlYKgSPO7
 CvRhh/MrSGVXZd3NxdN8InPeENWJgS9Pz5CYiGRkl2HmbolEJk8I26kL16lhiR3bBg
 nsE4Q9gg/5RGQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VBhgB2BW5z9rxG;
 Sat,  6 Apr 2024 19:09:58 +0200 (CEST)
From: Charalampos Mitrodimas <charmitro@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
In-Reply-To: <jwv34s0lrre.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Thu, 04 Apr 2024 17:53:33 -0400")
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
 <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
 <jwv34s0lrre.fsf-monnier+emacs@HIDDEN>
Date: Sat, 06 Apr 2024 17:09:56 +0000
Message-ID: <m27chamn8b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Stefan Monnier <monnier@HIDDEN> writes:

>> Just to clarify, are you referring to something like this?
>>
>> =C2=A0=C2=A0=C2=A0 (key-translate "C-x" "C-z" "C-a")
>
> No, rather (key-translate "C-a C-z" "C-x b")
>
>
>         Stefan

Thanks for clarifying this! Updated patch attached.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Improve-key-translate-to-support-removing-translatio.patch
Content-Description: patch

From 34a045b66ecc4e7428952c6a1f8ce4b7c7dfd7ce Mon Sep 17 00:00:00 2001
From: Charalampos Mitrodimas <charmitro@HIDDEN>
Date: Tue, 2 Apr 2024 19:02:46 +0000
Subject: [PATCH] Improve key-translate to support removing translations

This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).

If TO is nil, any existing translation for the FROM key will be removed.
The compiler macro is updated to only check TO when it is non-nil.

This change makes key-translate more consistent with the behavior of
keyboard-translate, providing a way to remove translations without
having to specify the same key for both FROM and TO.

The documentation string is updated to reflect the new behavior.

* lisp/keymap.el (key-translate): support removing translations by
  passing nil as the second argument (TO). Also throw error if multiple
  items passed. (Bug#70139)
---
 lisp/keymap.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/keymap.el b/lisp/keymap.el
index 4bdf65d39fa..94dcb592305 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -382,17 +382,19 @@ key-translate
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it.
 
-Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
+Both FROM and TO should be specified by strings that satisfy `key-valid-p'.
+If TO is nil, remove any existing translation for FROM."
   (declare (compiler-macro
-            (lambda (form) (keymap--compile-check from to) form)))
+            (lambda (form) (keymap--compile-check from (and to to)) form)))
   (keymap--check from)
-  (keymap--check to)
+  (when to
+    (keymap--check to))
   (or (char-table-p keyboard-translate-table)
       (setq keyboard-translate-table
             (make-char-table 'keyboard-translate-table nil)))
   (aset keyboard-translate-table
         (aref (key-parse from) 0)
-        (aref (key-parse to) 0)))
+        (and to (aref (key-parse to) 0))))
 
 (defun keymap-lookup (keymap key &optional accept-default no-remap position)
   "Return the binding for command KEY in KEYMAP.
-- 
2.39.3 (Apple Git-146)


--=-=-=
Content-Type: text/plain


--
Charalampos

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 4 Apr 2024 21:53:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 17:53:50 2024
Received: from localhost ([127.0.0.1]:34870 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsV1q-0006Bv-1C
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 17:53:50 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:9733)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rsV1n-0006BW-6f
 for 70139 <at> debbugs.gnu.org; Thu, 04 Apr 2024 17:53:48 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 504E94436CF;
 Thu,  4 Apr 2024 17:53:35 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1712267614;
 bh=ZQCsfsGs70kQHpuRbPutBNn9/IYva5dC0qklEuJZ3bc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=KWiyOpcjnxhD9qziYqW3YCApobTyXUey7W0Et5IWofFONWl7bPS0ulYrjdPXL0PWQ
 mgzyHAWCXR7Xp8x4YZoPY11kodM4zJ9WX7dJxRkiUR3j5oXUb65GOizPsqJLHwKtxd
 N7LntUWq9Df6ZeP2orG5mtz2T5mlCk5m+M/a+Ux2PuzH7wdVb0gtLXFLD9M+ook4kc
 ImQK2l77fz4Bmh2tih8lMFudyDt45Tn+V9GwRjnxCYaIxBELAk+G7Y9yU2GMy/MCa3
 8EIfCEck4SAwSXuwv8jCHxM7oyQ91BujrgeGPjI30RN/RrKk8wzy2GlcMpduHgegPA
 13KqaxcNl/GMQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 16515443693;
 Thu,  4 Apr 2024 17:53:34 -0400 (EDT)
Received: from pastel (unknown [45.72.201.215])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DF9B2120314;
 Thu,  4 Apr 2024 17:53:33 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Charalampos Mitrodimas <charmitro@HIDDEN>
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
In-Reply-To: <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN> (Charalampos
 Mitrodimas's message of "Thu,  4 Apr 2024 19:48:16 +0000")
Message-ID: <jwv34s0lrre.fsf-monnier+emacs@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
 <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
Date: Thu, 04 Apr 2024 17:53:33 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.046 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Just to clarify, are you referring to something like this?
>
> =A0=A0=A0 (key-translate "C-x" "C-z" "C-a")

No, rather (key-translate "C-a C-z" "C-x b")


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 4 Apr 2024 19:48:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 15:48:35 2024
Received: from localhost ([127.0.0.1]:34736 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsT4b-00053d-L8
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 15:48:35 -0400
Received: from mout02.posteo.de ([185.67.36.66]:36593)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rsT4Y-000526-G9
 for 70139 <at> debbugs.gnu.org; Thu, 04 Apr 2024 15:48:31 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id DD207240101
 for <70139 <at> debbugs.gnu.org>; Thu,  4 Apr 2024 21:48:18 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712260098; bh=SDGrwq4oSpgBLBQuUbcYcLqMLhqizNcok31zgDYcMhk=;
 h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:Content-Type:
 Content-Transfer-Encoding:From;
 b=UNtVgKD4hRREXLTTmiQzZoQjpvGi0/nMoYbM9T5chpu1POIB9C47NkHEj04ZVZWh6
 S/CG1zGL4SAscml71zi7yhqioRMy7gmA8QOwoAWCCxr4TTo8Gry+FnY+P1p/vpNjfn
 7QHEWXvJfQYZMgJBD4rx6dPF83LkJj4rkaajwmyCtiiOr1D8MfyiF8DT5r/og5nmXv
 nEHg08kM1RvOZ1/O4r2PL615MxB9HIBli/nh5zH9U9DUo60gjJ14xR4xTzu/Qo9W8w
 /thRYkPKFRV4DA+9bm3eb5bbED0pwVcaZuqDW3OaW5aQd0cv8nROWJLyUmsPdLWaSx
 sLX4KU6goSLUQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V9XGp0MxTz9rxG;
 Thu,  4 Apr 2024 21:48:17 +0200 (CEST)
Message-ID: <a1822f0a-8e70-41f9-8413-d02fd704685e@HIDDEN>
Date: Thu,  4 Apr 2024 19:48:16 +0000
MIME-Version: 1.0
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
To: Stefan Monnier <monnier@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
 <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
From: Charalampos Mitrodimas <charmitro@HIDDEN>
Content-Language: en-US
In-Reply-To: <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Thanks for your review, much appreciated.

On 4/4/24 4:00 PM, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> I don't have much to say about this bug report or the fix for it, I'm
> not very familiar with the `keyboard-translate-table` part of our
> input processing.
>
>>     (aset keyboard-translate-table
>>           (aref (key-parse from) 0)
>> -        (aref (key-parse to) 0)))
>> +        (and to (aref (key-parse to) 0))))
> But here, I think that, in keeping with the tradition of the `key-*`
> functions, we should signal an error if `key-parse` returns an array
> longer than 1 element, instead of just using the first element and
> silently dropping the rest on the floor.
>
>
>          Stefan

Just to clarify, are you referring to something like this?

     (key-translate "C-x" "C-z" "C-a")


--
Charalampos





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 4 Apr 2024 13:00:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 09:00:47 2024
Received: from localhost ([127.0.0.1]:60802 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsMhz-00030S-3x
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 09:00:47 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6364)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rsMhw-0002zT-F8
 for 70139 <at> debbugs.gnu.org; Thu, 04 Apr 2024 09:00:45 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BA27980DB3;
 Thu,  4 Apr 2024 09:00:33 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1712235632;
 bh=HrnDVHuuyY7q3nl8VaHC/fG8RySoAKjHGly5/n+8tVU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=mif6rmPBxzpI5rPcj67OMOl0tcnWGZ+k+AT28Ml32EUpHWplHOs5eI7mT1OZRii77
 FAGhHN0wtSUHjnMQ2oa2vnsbQ8ijTb7qbMESOXZxLrqbnVaqtM7zHOrYqDykXsKFyi
 Pv0/0+2wxBX/C6X1EfZqmXpk0ecS+iPeNBITpkPJn7BZ1LxzRnhrWYMxQ/Y1cDRC2X
 PUsMJLVhxV/yVOdlv03LhMB011WZ97v19Ok/+Ioqeda/GXa615U7A9SWN4ZhWKgM76
 v4JSMwJkbGBYEO3aDf26Q5mBCPR+tEczDSZqyt6css8s2tk+IHq0QBTXFpwutBe0vd
 L6dpcL4pN7RaQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DBD6580136;
 Thu,  4 Apr 2024 09:00:32 -0400 (EDT)
Received: from pastel (unknown [45.72.201.215])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BABA412030C;
 Thu,  4 Apr 2024 09:00:32 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Charalampos Mitrodimas <charmitro@HIDDEN>
Subject: Re: bug#70139: [PATCH] Improve key-translate to support removing
 translations
In-Reply-To: <20240402190246.1824023-1-charmitro@HIDDEN> (Charalampos
 Mitrodimas's message of "Tue,  2 Apr 2024 19:02:46 +0000")
Message-ID: <jwvjzldl1y2.fsf-monnier+emacs@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
 <20240402190246.1824023-1-charmitro@HIDDEN>
Date: Thu, 04 Apr 2024 09:00:31 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.124 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

I don't have much to say about this bug report or the fix for it, I'm
not very familiar with the `keyboard-translate-table` part of our
input processing.

>    (aset keyboard-translate-table
>          (aref (key-parse from) 0)
> -        (aref (key-parse to) 0)))
> +        (and to (aref (key-parse to) 0))))

But here, I think that, in keeping with the tradition of the `key-*`
functions, we should signal an error if `key-parse` returns an array
longer than 1 element, instead of just using the first element and
silently dropping the rest on the floor.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 4 Apr 2024 12:27:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 04 08:27:57 2024
Received: from localhost ([127.0.0.1]:60748 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rsMCC-0008O9-12
	for submit <at> debbugs.gnu.org; Thu, 04 Apr 2024 08:27:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39524)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rsMC8-0008Nl-O0
 for 70139 <at> debbugs.gnu.org; Thu, 04 Apr 2024 08:27:55 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1rsMBy-0003eJ-8c; Thu, 04 Apr 2024 08:27:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=HDhmzL9bfMPtxkrZCpAmrywHduOmcBVBN+Meud5o7jQ=; b=IZ/c3sfEV3Q+vwVkNGBc
 otWlJ+bi7ugusqNqNRj0h3w6ZJvmTOOpIIYx8wda3RWmOqPFXbL0eqtYrRGjzTakYGci+ACcvlhCv
 nHh1A9PSgNWD2i3yJwtpId8ZgYmuGVwFx2L+8dduoEJZe177YZRLVxcRMQWV2BMUgJbkXEehHyEpp
 0IbY8y61b2Q2X3Etn+galSxTlU8yykXnirhr94BzUiFtFp4opptThKhxSg2B5NcJsy/XpsMXqAoSL
 qLGaXslvlhiQzQNuhMXqaA/JD4rb2Ld7nHCE8FQ3evibzgw7/RnmG33NdV81uiuf+VXTdhdtklo1/
 /LaNEPaFssW9uw==;
Date: Thu, 04 Apr 2024 15:27:39 +0300
Message-Id: <86o7ap71ok.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <87v850t7nz.fsf@HIDDEN> (message from Robert Pluim on Tue, 02
 Apr 2024 11:50:40 +0200)
Subject: Re: bug#70139: 29.3.50;
 key-translate does not support all keyboard-translate usages
References: <87v850t7nz.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Robert Pluim <rpluim@HIDDEN>
> Date: Tue, 02 Apr 2024 11:50:40 +0200
> 
> 
> When `key-translate' was added, it didnʼt cover all the cases that
> `keyboard-translate' does.
> 
> Add a translation:
> 
>     (keyboard-translate ?\C-a ?\C-z)
> 
> Two ways to remove, of which I submit the first is 'obvious':
> 
>     (keyboard-translate ?\C-a nil)
>     (keyboard-translate ?\C-a ?\C-a)
> 
> Add:
> 
>     (key-translate "C-a" "C-z")
> 
> This works for removing a translation but is non-obvious:
> 
>     (key-translate "C-a" "C-a")
> 
> But this doesnʼt:
> 
>     (key-translate "C-a" nil)
> 
> =>
> Debugger entered--Lisp error: (error "nil is not a valid key definition; see ‘key-valid-...")
>   signal(error ("nil is not a valid key definition; see ‘key-valid-..."))
>   error("%S is not a valid key definition; see `key-valid-p..." nil)
> 
> Iʼm not sure this is worth fixing, but perhaps documenting that
> re-adding the same translation is (almost) the same as removing it?

Stefan, any comments or suggestions?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 2 Apr 2024 19:03:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 15:03:12 2024
Received: from localhost ([127.0.0.1]:56346 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrjPc-0002Gn-9j
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 15:03:12 -0400
Received: from mout02.posteo.de ([185.67.36.66]:37621)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rrjPZ-0002GF-BJ
 for 70139 <at> debbugs.gnu.org; Tue, 02 Apr 2024 15:03:10 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 37F69240103
 for <70139 <at> debbugs.gnu.org>; Tue,  2 Apr 2024 21:02:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712084579; bh=+m24owsUu+pocQgmdZuqK22l9rnbsJP52/LD6YWgV60=;
 h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:
 Content-Transfer-Encoding:From;
 b=rhTrKgrgvbGWLrtsCyzwxytSE56HSmGrX1deY30I7bAFs8yiTAb0L+roqlPdKNBik
 8ID54p87NEy/soKUiPJNUwiQfKTYo7ila5pHkORDMk+hWLBVaLBBTOpZnAfF/Lpfzp
 jxeE72M/sTlZKLlRLwU6el04FizRfzQ2Y5dXMFxudCu1Zo87c854evkep0WlPfv4Lb
 rHbGXwFIbXSgMuEe19KJ3smwN3pQJyMzjmBWqzA1i4S0ZGn/glHrmxAelaE67miNih
 aQIN5/VzzyBYMRwSMVMT0D0nV4YrIOgFWMFBqc6FXhRubBv8ZmaC6d+qENeeoc18xg
 mIriXTiQPJjaQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V8HMQ34ltz9rxP;
 Tue,  2 Apr 2024 21:02:58 +0200 (CEST)
From: Charalampos Mitrodimas <charmitro@HIDDEN>
To: 70139 <at> debbugs.gnu.org
Subject: [PATCH] Improve key-translate to support removing translations
Date: Tue,  2 Apr 2024 19:02:46 +0000
Message-Id: <20240402190246.1824023-1-charmitro@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
Cc: Charalampos Mitrodimas <charmitro@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).

If TO is nil, any existing translation for the FROM key will be removed.
The compiler macro is updated to only check TO when it is non-nil.

This change makes key-translate more consistent with the behavior of
keyboard-translate, providing a way to remove translations without
having to specify the same key for both FROM and TO.

The documentation string is updated to reflect the new behavior.

* lisp/keymap.el (key-translate): support removing translations by
  passing nil as the second argument (TO). (Bug#70139)
---
 lisp/keymap.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/keymap.el b/lisp/keymap.el
index b2b475c7d71..1481f1fe72b 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -382,17 +382,19 @@ key-translate
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it.
 
-Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
+Both FROM and TO should be specified by strings that satisfy `key-valid-p'.
+If TO is nil, remove any existing translation for FROM."
   (declare (compiler-macro
-            (lambda (form) (keymap--compile-check from to) form)))
+            (lambda (form) (keymap--compile-check from (and to to)) form)))
   (keymap--check from)
-  (keymap--check to)
+  (when to
+    (keymap--check to))
   (or (char-table-p keyboard-translate-table)
       (setq keyboard-translate-table
             (make-char-table 'keyboard-translate-table nil)))
   (aset keyboard-translate-table
         (aref (key-parse from) 0)
-        (aref (key-parse to) 0)))
+        (and to (aref (key-parse to) 0))))
 
 (defun keymap-lookup (keymap key &optional accept-default no-remap position)
   "Return the binding for command KEY in KEYMAP.
-- 
2.34.1





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 2 Apr 2024 16:01:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 12:01:51 2024
Received: from localhost ([127.0.0.1]:55042 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrga5-0005nX-H3
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 12:01:51 -0400
Received: from mout01.posteo.de ([185.67.36.65]:34595)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rrf8E-0000FF-CO
 for 70139 <at> debbugs.gnu.org; Tue, 02 Apr 2024 10:29:01 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 3C9EE240027
 for <70139 <at> debbugs.gnu.org>; Tue,  2 Apr 2024 16:28:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712068128; bh=Lr1YbGuFd62NI/9QBPTQPC4DROVE1VMTs5kBz+AVW2Y=;
 h=Content-Type:Message-ID:Date:MIME-Version:Subject:To:Cc:From:
 From;
 b=YdpIuJ7fs4H4B7L2IFqPn3t18mxk19+2J2yltEELAs7siJoVHqP6AnEfZlyAwwCc2
 YeTQmLa52wLfSi4/O8od16ike7Vvt/RNi2ydsCTZrBQPHjU8VoanqaBuBFlMQlQREq
 9zgWOmEbZi/NQzgxLSvshHwmyfPoz0OU6LZu+js9KLjHCy2bUoll1xjSbsuM/qkic2
 GEXx8Bw/UC6bY/lSlvd6e9GXEGEDHT3Bj+FtJsLgLiSkhwOVj5HEA6Y+newVZcrL6t
 Dt8wLU1cd0DV05xrQNn1hFFhmXsadxQKDEB2WrIqLJGQuT1dN4+ayPiHAE1m67yzdu
 pbvdvpW0W2o3A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V89H348kTz9rxT;
 Tue,  2 Apr 2024 16:28:47 +0200 (CEST)
Content-Type: multipart/mixed; boundary="------------s2bEnr4L4gsAjk0B9bgA92cL"
Message-ID: <d02f63b7-1355-426d-b153-567918413245@HIDDEN>
Date: Tue,  2 Apr 2024 14:28:47 +0000
MIME-Version: 1.0
Subject: Re: bug#70139: 29.3.50; key-translate does not support all
 keyboard-translate usages
To: Robert Pluim <rpluim@HIDDEN>
References: <87v850t7nz.fsf@HIDDEN>
Content-Language: en-US
From: Charalampos Mitrodimas <charmitro@HIDDEN>
In-Reply-To: <87v850t7nz.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
X-Mailman-Approved-At: Tue, 02 Apr 2024 12:01:46 -0400
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

This is a multi-part message in MIME format.
--------------s2bEnr4L4gsAjk0B9bgA92cL
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit


On 4/2/24 12:50, Robert Pluim wrote:
> When `key-translate' was added, it didnʼt cover all the cases that
> `keyboard-translate' does.
>
> Add a translation:
>
>      (keyboard-translate ?\C-a ?\C-z)
>
> Two ways to remove, of which I submit the first is 'obvious':
>
>      (keyboard-translate ?\C-a nil)
>      (keyboard-translate ?\C-a ?\C-a)
>
> Add:
>
>      (key-translate "C-a" "C-z")
>
> This works for removing a translation but is non-obvious:
>
>      (key-translate "C-a" "C-a")
>
> But this doesnʼt:
>
>      (key-translate "C-a" nil)
>
> =>
> Debugger entered--Lisp error: (error "nil is not a valid key definition; see ‘key-valid-...")
>    signal(error ("nil is not a valid key definition; see ‘key-valid-..."))
>    error("%S is not a valid key definition; see `key-valid-p..." nil)
>
> Iʼm not sure this is worth fixing, but perhaps documenting that
> re-adding the same translation is (almost) the same as removing it?
>
> Thanks
>
> Robert
>
> In GNU Emacs 29.3.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
>   3.24.38, cairo version 1.16.0) of 2024-04-02 built on rltb
> Repository revision: 6b8b0a12333afeadb32744ba481679b05b758ed2
> Repository branch: emacs-29
> Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
> System Description: Debian GNU/Linux 12 (bookworm)
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
> INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

I accidentally sent the patch the wrong way (newcomer here), attaching here.

--
Charalampos Mitrodimas

--------------s2bEnr4L4gsAjk0B9bgA92cL
Content-Type: text/x-patch; charset=UTF-8;
 name="0001-Improve-key-translate-to-support-removing-translatio.patch"
Content-Disposition: attachment;
 filename*0="0001-Improve-key-translate-to-support-removing-translatio.pa";
 filename*1="tch"
Content-Transfer-Encoding: base64

RnJvbSA0YzM1ZTQ1YzEyOGQ4YWQwYzkzYWM3ODdmZTUxZWVjYmNkNTcwMjg2IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBDaGFyYWxhbXBvcyBNaXRyb2RpbWFzIDxjaGFybWl0
cm9AcG9zdGVvLm5ldD4KRGF0ZTogVHVlLCAyIEFwciAyMDI0IDE3OjIwOjQ0ICswMzAwClN1
YmplY3Q6IFtQQVRDSF0gSW1wcm92ZSBrZXktdHJhbnNsYXRlIHRvIHN1cHBvcnQgcmVtb3Zp
bmcgdHJhbnNsYXRpb25zCgpUaGlzIHBhdGNoIGVuaGFuY2VzIHRoZSBrZXktdHJhbnNsYXRl
IGZ1bmN0aW9uIHRvIGFsbG93IHJlbW92aW5nCmtleWJvYXJkIHRyYW5zbGF0aW9ucyBieSBw
YXNzaW5nIG5pbCBhcyB0aGUgc2Vjb25kIGFyZ3VtZW50IChUTykuCgpJZiBUTyBpcyBuaWws
IGFueSBleGlzdGluZyB0cmFuc2xhdGlvbiBmb3IgdGhlIEZST00ga2V5IHdpbGwgYmUgcmVt
b3ZlZC4KVGhlIGNvbXBpbGVyIG1hY3JvIGlzIHVwZGF0ZWQgdG8gb25seSBjaGVjayBUTyB3
aGVuIGl0IGlzIG5vbi1uaWwuCgpUaGlzIGNoYW5nZSBtYWtlcyBrZXktdHJhbnNsYXRlIG1v
cmUgY29uc2lzdGVudCB3aXRoIHRoZSBiZWhhdmlvciBvZgprZXlib2FyZC10cmFuc2xhdGUs
IHByb3ZpZGluZyBhIHdheSB0byByZW1vdmUgdHJhbnNsYXRpb25zIHdpdGhvdXQKaGF2aW5n
IHRvIHNwZWNpZnkgdGhlIHNhbWUga2V5IGZvciBib3RoIEZST00gYW5kIFRPLgoKVGhlIGRv
Y3VtZW50YXRpb24gc3RyaW5nIGlzIHVwZGF0ZWQgdG8gcmVmbGVjdCB0aGUgbmV3IGJlaGF2
aW9yLgotLS0KIGxpc3Ava2V5bWFwLmVsIHwgMTAgKysrKysrLS0tLQogMSBmaWxlIGNoYW5n
ZWQsIDYgaW5zZXJ0aW9ucygrKSwgNCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9saXNw
L2tleW1hcC5lbCBiL2xpc3Ava2V5bWFwLmVsCmluZGV4IGIyYjQ3NWM3ZDcxLi4xNDgxZjFm
ZTcyYiAxMDA2NDQKLS0tIGEvbGlzcC9rZXltYXAuZWwKKysrIGIvbGlzcC9rZXltYXAuZWwK
QEAgLTM4MiwxNyArMzgyLDE5IEBAIGtleS10cmFuc2xhdGUKIFRoaXMgZnVuY3Rpb24gY3Jl
YXRlcyBhIGBrZXlib2FyZC10cmFuc2xhdGUtdGFibGUnIGlmIG5lY2Vzc2FyeQogYW5kIHRo
ZW4gbW9kaWZpZXMgb25lIGVudHJ5IGluIGl0LgogCi1Cb3RoIEZST00gYW5kIFRPIHNob3Vs
ZCBiZSBzcGVjaWZpZWQgYnkgc3RyaW5ncyB0aGF0IHNhdGlzZnkgYGtleS12YWxpZC1wJy4i
CitCb3RoIEZST00gYW5kIFRPIHNob3VsZCBiZSBzcGVjaWZpZWQgYnkgc3RyaW5ncyB0aGF0
IHNhdGlzZnkgYGtleS12YWxpZC1wJy4KK0lmIFRPIGlzIG5pbCwgcmVtb3ZlIGFueSBleGlz
dGluZyB0cmFuc2xhdGlvbiBmb3IgRlJPTS4iCiAgIChkZWNsYXJlIChjb21waWxlci1tYWNy
bwotICAgICAgICAgICAgKGxhbWJkYSAoZm9ybSkgKGtleW1hcC0tY29tcGlsZS1jaGVjayBm
cm9tIHRvKSBmb3JtKSkpCisgICAgICAgICAgICAobGFtYmRhIChmb3JtKSAoa2V5bWFwLS1j
b21waWxlLWNoZWNrIGZyb20gKGFuZCB0byB0bykpIGZvcm0pKSkKICAgKGtleW1hcC0tY2hl
Y2sgZnJvbSkKLSAgKGtleW1hcC0tY2hlY2sgdG8pCisgICh3aGVuIHRvCisgICAgKGtleW1h
cC0tY2hlY2sgdG8pKQogICAob3IgKGNoYXItdGFibGUtcCBrZXlib2FyZC10cmFuc2xhdGUt
dGFibGUpCiAgICAgICAoc2V0cSBrZXlib2FyZC10cmFuc2xhdGUtdGFibGUKICAgICAgICAg
ICAgIChtYWtlLWNoYXItdGFibGUgJ2tleWJvYXJkLXRyYW5zbGF0ZS10YWJsZSBuaWwpKSkK
ICAgKGFzZXQga2V5Ym9hcmQtdHJhbnNsYXRlLXRhYmxlCiAgICAgICAgIChhcmVmIChrZXkt
cGFyc2UgZnJvbSkgMCkKLSAgICAgICAgKGFyZWYgKGtleS1wYXJzZSB0bykgMCkpKQorICAg
ICAgICAoYW5kIHRvIChhcmVmIChrZXktcGFyc2UgdG8pIDApKSkpCiAKIChkZWZ1biBrZXlt
YXAtbG9va3VwIChrZXltYXAga2V5ICZvcHRpb25hbCBhY2NlcHQtZGVmYXVsdCBuby1yZW1h
cCBwb3NpdGlvbikKICAgIlJldHVybiB0aGUgYmluZGluZyBmb3IgY29tbWFuZCBLRVkgaW4g
S0VZTUFQLgotLSAKMi4zNC4xCgo=

--------------s2bEnr4L4gsAjk0B9bgA92cL--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 2 Apr 2024 16:01:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 12:01:49 2024
Received: from localhost ([127.0.0.1]:55040 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrga3-0005nK-RG
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 12:01:49 -0400
Received: from mout01.posteo.de ([185.67.36.65]:38543)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1rrf1a-0007zU-KN
 for 70139 <at> debbugs.gnu.org; Tue, 02 Apr 2024 10:22:08 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 9778C240029
 for <70139 <at> debbugs.gnu.org>; Tue,  2 Apr 2024 16:21:56 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1712067716; bh=+aXoAmFeoTHjo+B160StGHzU7rBGCuj05HiKu+fUSg4=;
 h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:
 Content-Transfer-Encoding:From;
 b=isnXJiCfauSBfuhhsj96pblQB8qf6VBKuPvKE7/b5skxGqHVSAGG/mDHPu/D3MtlZ
 T3LKgzeEzgBLta8OGjzrHPEK9zgWJ7B+zClgLzQak1RxH55eMWbMrO7TeWfeH8N/h+
 m/8YzHTs6FERfzmB/7ChWybDmKuPShfanY9pRa5tq3zNe4/wK6KR3mkA3c+H9ocJP3
 JE4Oa/TmgcJ0u+V4gTrqaThGjZ6aytYH63fFjQa3zoxV7QJM4xXAYJDJwxUiMehZTc
 kUzy/rbQSGRlrPVSNlmHrQWCGXSfQ/tGdcuJGoEOXoljhR75oa7jL5EDVpuoIPz6X2
 UZXfvVhwLb8DA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4V89780zTzz6tm8;
 Tue,  2 Apr 2024 16:21:55 +0200 (CEST)
From: Charalampos Mitrodimas <charmitro@HIDDEN>
To: 70139 <at> debbugs.gnu.org
Subject: [PATCH] Improve key-translate to support removing translations
Date: Tue,  2 Apr 2024 14:21:50 +0000
Message-Id: <20240402142150.1211286-1-charmitro@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 70139
X-Mailman-Approved-At: Tue, 02 Apr 2024 12:01:46 -0400
Cc: Charalampos Mitrodimas <charmitro@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).

If TO is nil, any existing translation for the FROM key will be removed.
The compiler macro is updated to only check TO when it is non-nil.

This change makes key-translate more consistent with the behavior of
keyboard-translate, providing a way to remove translations without
having to specify the same key for both FROM and TO.

The documentation string is updated to reflect the new behavior.
---
 lisp/keymap.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/keymap.el b/lisp/keymap.el
index b2b475c7d71..1481f1fe72b 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -382,17 +382,19 @@ key-translate
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it.
 
-Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
+Both FROM and TO should be specified by strings that satisfy `key-valid-p'.
+If TO is nil, remove any existing translation for FROM."
   (declare (compiler-macro
-            (lambda (form) (keymap--compile-check from to) form)))
+            (lambda (form) (keymap--compile-check from (and to to)) form)))
   (keymap--check from)
-  (keymap--check to)
+  (when to
+    (keymap--check to))
   (or (char-table-p keyboard-translate-table)
       (setq keyboard-translate-table
             (make-char-table 'keyboard-translate-table nil)))
   (aset keyboard-translate-table
         (aref (key-parse from) 0)
-        (aref (key-parse to) 0)))
+        (and to (aref (key-parse to) 0))))
 
 (defun keymap-lookup (keymap key &optional accept-default no-remap position)
   "Return the binding for command KEY in KEYMAP.
-- 
2.34.1





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at 70139 <at> debbugs.gnu.org:


Received: (at 70139) by debbugs.gnu.org; 2 Apr 2024 15:42:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 11:42:03 2024
Received: from localhost ([127.0.0.1]:55031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rrgGw-0001Ha-V6
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 11:42:03 -0400
Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:57434)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1rrgGv-0001Gc-37
 for 70139 <at> debbugs.gnu.org; Tue, 02 Apr 2024 11:42:02 -0400
Received: by mail-wr1-x42c.google.com with SMTP id
 ffacd0b85a97d-3436fec6a70so467860f8f.2
 for <70139 <at> debbugs.gnu.org>; Tue, 02 Apr 2024 08:41:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712072510; x=1712677310; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=WEGDIbfc0NGmUkqseTVsV4W2oGcmskVQR3eAFJ29otA=;
 b=RQhweflJmou+lRqdDXq9EqUoT9GBk1E8Qg5YPSZLken4ByrWOwS/cmxqDsclrAQ7HS
 SjL8KgvlYnwGJ0+zb+Y7fr/eJcjue6h2Ndp4V8uXGyJSIPme7nLGTnIcjjW9pcQw0AjC
 tzlHN3A+VrZNs9P0UdUumR2z+OdJJlmDSodaUbAFxENP8FmVZPcI5Xe12saiaF2riC0Z
 lH2dhuIH2vsPEcSUWNHCdcuP01X2MnLW6E/kgl6waVmiKvzcST8lJf8/0iCxQpG1kWqQ
 GyWAjJZtEnrw+LqFlRIuyg7UnAZChE4QQMXUH8ZAlS/05CT5QZWN+5TD/IoiX3JjVvFE
 OtpA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712072510; x=1712677310;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=WEGDIbfc0NGmUkqseTVsV4W2oGcmskVQR3eAFJ29otA=;
 b=njW4g/wh+9b7G4ZFkBytNOwwdez2TIH7ciLZ/YEAExLGwpwlRpC+KRvfwCaWy12qtp
 yUWGe1eAYlAJYPQnie9bELdHFYMHjr3DRv4XO78ks5hv9iO2KuzM3lH/EXz369Y3zm8A
 ksOj6KqkH4qp2OWW0b9XmHVFxcjBBTtb8uHIMTxBxM8e1k96VfbMnv5glmmehfKJK4BX
 IqYFWf4RkNfJutxQmkgfN8eroN+Wf/YQwLrCzQN+M4vKLwMRCa1YwbyC5PdpTm3eGNnB
 NCgyTtYZnirlmL2guNOzbCEVidvK5lO9tan/UsPhWQrhL/E4Q4canunQq0R33XcUGjbl
 HvbA==
X-Gm-Message-State: AOJu0YypTibs11kYJQKn2jP/B0QuQR18SHowi+1/YsYxOKFpNAwi8MWB
 VEUp8+WFc20Q7pj9X/0iFM4I1V54mqFSUpbNVHFtMk0LVSSellOw/vj3xCfL
X-Google-Smtp-Source: AGHT+IEBprn55ijq63otuzNo1LyD8mUvsjMvHHVKmwUwTt7KFoTWZw5JeFXEHWtSmONG2UR4aiPAzA==
X-Received: by 2002:adf:e246:0:b0:343:84ca:ef27 with SMTP id
 bl6-20020adfe246000000b0034384caef27mr78084wrb.41.1712072510099; 
 Tue, 02 Apr 2024 08:41:50 -0700 (PDT)
Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id
 dq6-20020a0560000cc600b00341c3071c93sm14524573wrb.73.2024.04.02.08.41.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 02 Apr 2024 08:41:49 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Charalampos Mitrodimas <charmitro@HIDDEN>
Subject: Re: bug#70139: 29.3.50; key-translate does not support all
 keyboard-translate usages
In-Reply-To: <d02f63b7-1355-426d-b153-567918413245@HIDDEN> (Charalampos
 Mitrodimas's message of "Tue, 2 Apr 2024 14:28:47 +0000")
References: <87v850t7nz.fsf@HIDDEN>
 <d02f63b7-1355-426d-b153-567918413245@HIDDEN>
Date: Tue, 02 Apr 2024 17:41:47 +0200
Message-ID: <87edbnu5z8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70139
Cc: 70139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Tue,  2 Apr 2024 14:28:47 +0000, Charalampos Mitrodimas <charmitro@HIDDEN> said:

The patch looks ok, it needs a ChangeLog entry style commit message
though (see the "** Commit messages" and "** Generating ChangeLog
entries" sections of CONTRIBUTE).

For extra credit, update the emacs lisp manual entry for
`key-translate' :-)

    Charalampos> From 4c35e45c128d8ad0c93ac787fe51eecbcd570286 Mon Sep 17 00:00:00 2001
    Charalampos> From: Charalampos Mitrodimas <charmitro@HIDDEN>
    Charalampos> Date: Tue, 2 Apr 2024 17:20:44 +0300
    Charalampos> Subject: [PATCH] Improve key-translate to support removing translations

    Charalampos> This patch enhances the key-translate function to allow removing
    Charalampos> keyboard translations by passing nil as the second argument (TO).

    Charalampos> If TO is nil, any existing translation for the FROM key will be removed.
    Charalampos> The compiler macro is updated to only check TO when it is non-nil.

    Charalampos> This change makes key-translate more consistent with the behavior of
    Charalampos> keyboard-translate, providing a way to remove translations without
    Charalampos> having to specify the same key for both FROM and TO.

    Charalampos> The documentation string is updated to reflect the new behavior.

Robert
-- 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Apr 2024 09:51:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 02 05:51:05 2024
Received: from localhost ([127.0.0.1]:52549 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rranI-0006Eg-Pe
	for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 05:51:05 -0400
Received: from lists.gnu.org ([2001:470:142::17]:36178)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1rranF-0006DW-4d
 for submit <at> debbugs.gnu.org; Tue, 02 Apr 2024 05:51:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rpluim@HIDDEN>) id 1rran4-0001T2-Sg
 for bug-gnu-emacs@HIDDEN; Tue, 02 Apr 2024 05:50:50 -0400
Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <rpluim@HIDDEN>) id 1rran2-00079r-8h
 for bug-gnu-emacs@HIDDEN; Tue, 02 Apr 2024 05:50:50 -0400
Received: by mail-wr1-x42b.google.com with SMTP id
 ffacd0b85a97d-34339f01cd2so2936651f8f.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 02 Apr 2024 02:50:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712051443; x=1712656243; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=qvOtMiKnpqSUyaZzN3pvyQrPy1PYCtpJawdYwtR/qvc=;
 b=il9ETwYRTO58R/3BqznYSesupV1v4q0NGYJLbGsQ+pWVSlRV4qbNQDaQeDW5QO7tu0
 cKABMWSW+lHS4AqCZ133HYyXGJ55tnGaCvQloqon+C7wBRRqUCGbVRk5Hw64S0uHs7tt
 o2KenQwrFG7zUCOZJhtEtnyxurC1cHIuBJP9XQBlSlnWqJOC/aJXCB4ZHpGh2Ar/bUYs
 sRPWAAn0gDGMULF9ZBbcPJ9Z3a0UYasnIr4aQoxPocsyYSVt9t4P6MR4gsU8+knQds+z
 bp3gZp2m+qTyELIc3rBbWDfXxWV/M6wGMh6uEs8Uga3szSYJ2qYBJrChVgP8nxRD1NAI
 WZlA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712051443; x=1712656243;
 h=content-transfer-encoding:mime-version:message-id:date:subject:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=qvOtMiKnpqSUyaZzN3pvyQrPy1PYCtpJawdYwtR/qvc=;
 b=SecPhKO7n2FdY4z/ffVVL8E7cTBjpwM6KjzQiA9/umRcSRfKyVSoVvjPqMcgRyqnpO
 kj5d9b95ADjyjUTLNo0pO03XBFrTOGuFA5iNvrwzIM5QXUzvYP21WaKw86BK2cWbMN5a
 dZh8kNn/Rk4kTckKXaGl+M71FLa+H+P1xe268tCwAijG5FhSUibf96giJeu3nL/vDlE3
 ZQkIsF/nmqRtDo9Ayr1jml821skpaDHoe9NP5tdm4aAXpRECBZB5ceSfYAIK1gQwMzGe
 Jq2LHMK1qxoi3EWMFm4JzxBJOI4KHz4CRuLHDjByz3OVJYRe74EQb77csVIC37dWdu15
 +cNQ==
X-Gm-Message-State: AOJu0YwFQkf1VGL2yUc3k50fvGjLjbO7ClkknQav9U+gVjE7dgdFBBqo
 m7P2KmxMe6NokRN5wvTXk+WUhVyz94OmcU5MtsR2u2Kf9VW32CjLL+NtRxM/
X-Google-Smtp-Source: AGHT+IHmmxgPZVUsJ/W0U7fAvhTB2u0YD51sVwO2mifm5vo24AMkNX+Nk6FVHprdzf1BiftTivcVXQ==
X-Received: by 2002:a5d:504a:0:b0:343:34a9:12bc with SMTP id
 h10-20020a5d504a000000b0034334a912bcmr6979225wrt.51.1712051442523; 
 Tue, 02 Apr 2024 02:50:42 -0700 (PDT)
Received: from rltb ([2a01:e0a:3f3:fb51:8463:f744:f487:d948])
 by smtp.gmail.com with ESMTPSA id
 g1-20020adfa481000000b00341e7e52802sm13799434wrb.92.2024.04.02.02.50.41
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 02 Apr 2024 02:50:41 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.3.50; key-translate does not support all keyboard-translate usages
Date: Tue, 02 Apr 2024 11:50:40 +0200
Message-ID: <87v850t7nz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2a00:1450:4864:20::42b;
 envelope-from=rpluim@HIDDEN; helo=mail-wr1-x42b.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


When `key-translate' was added, it didn=CA=BCt cover all the cases that
`keyboard-translate' does.

Add a translation:

    (keyboard-translate ?\C-a ?\C-z)

Two ways to remove, of which I submit the first is 'obvious':

    (keyboard-translate ?\C-a nil)
    (keyboard-translate ?\C-a ?\C-a)

Add:

    (key-translate "C-a" "C-z")

This works for removing a translation but is non-obvious:

    (key-translate "C-a" "C-a")

But this doesn=CA=BCt:

    (key-translate "C-a" nil)

=3D>
Debugger entered--Lisp error: (error "nil is not a valid key definition; se=
e =E2=80=98key-valid-...")
  signal(error ("nil is not a valid key definition; see =E2=80=98key-valid-=
..."))
  error("%S is not a valid key definition; see `key-valid-p..." nil)

I=CA=BCm not sure this is worth fixing, but perhaps documenting that
re-adding the same translation is (almost) the same as removing it?

Thanks

Robert

In GNU Emacs 29.3.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2024-04-02 built on rltb
Repository revision: 6b8b0a12333afeadb32744ba481679b05b758ed2
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Debian GNU/Linux 12 (bookworm)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
--=20




Acknowledgement sent to Robert Pluim <rpluim@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70139; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 9 Apr 2024 11:30:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.