From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: hugo@heagren.com Newsgroups: gmane.emacs.bugs Subject: bug#72460: [patch] add commands for setting keyboard translations interactively Date: Sat, 28 Sep 2024 16:33:09 +0100 Message-ID: References: <86bk0qit2b.fsf@gnu.org> <86o7486u3z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_dbc61c6def83ef56a0159613aa6373a9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36675"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.6.8 Cc: 72460@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 28 17:33:54 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1suZSD-0009NW-1J for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Sep 2024 17:33:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suZRy-0005hr-PG; Sat, 28 Sep 2024 11:33:38 -0400 Original-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 ) id 1suZRt-0005hZ-5D for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 11:33:33 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suZRs-0000Zz-SX for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 11:33:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:MIME-Version:To:Subject; bh=7kMsfmUu3CGTlPv+AZ2jVXlVXZLJdRijtPUVh1mrOQ4=; b=nfYBb8LuzulkFPb/MNsmq+rxopgRN6n7/f8XFxlQBNCdNR//xc9YQHXcdok4XMKSoAxaRgFRAI/iO4ZGPXQbKW3J2g0k6j9nGn2SLNCRLpleGqRtn6OL7DGqJnoAtXCfknGTNBLiCpcb2UFn0kW9QJj6I9hDB0Jx5VafYVu84jwAUVs43Fo63tGbd0Wg0PCeE9RfFKbBO2vCu9qoLQ3A+KqSAoqIg5RPuTXKo/sx0SI/GCVCqU8Oe8aURv8z4LSXkXjsj+StIzqpvETMpBto9jxeYBMYOuajbp3118geDULP3YsvsAYYMm94BFimsWUpjd88NVp0EUro7bo85r/2jw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suZSL-0007dQ-T6 for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 11:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: hugo@heagren.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Sep 2024 15:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72460 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72460-submit@debbugs.gnu.org id=B72460.172753763129318 (code B ref 72460); Sat, 28 Sep 2024 15:34:01 +0000 Original-Received: (at 72460) by debbugs.gnu.org; 28 Sep 2024 15:33:51 +0000 Original-Received: from localhost ([127.0.0.1]:36244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suZSA-0007cn-RZ for submit@debbugs.gnu.org; Sat, 28 Sep 2024 11:33:51 -0400 Original-Received: from whuk14.whukhost.com ([5.77.41.174]:60230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suZS7-0007cK-QK for 72460@debbugs.gnu.org; Sat, 28 Sep 2024 11:33:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heagren.com ; s=default; h=Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To: From:Date:MIME-Version:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7kMsfmUu3CGTlPv+AZ2jVXlVXZLJdRijtPUVh1mrOQ4=; b=mkGFJX7c8It4TymS5lNA2I76Te TVgMZ8erMEnvJitXX4ekWN1RpgSBS9QjoYGVUluKlZ4YR/PvaCOvENNAO+N/4jD0J6XZ7+rygB+Nq WlzhaKHk3RNl8OHMp3pKfhG/Pdm/5atk6+R24RCv56UN18iEbWjxA+aCU1lBff8IIo81G5Wgfp3sc BMt0qZ14Xdqu129T1YKjIKStipG7M0rR++WqxSVwtpeTEZTFQY1xtNHDJR3kj0PMdm6Gd6kPWiomw 1dqkQlggDiswOF0MXKKP8zOY7TxHjYT4ZVRrJKDezCYvwCUtObgOzmZnGhRlfJKEmM3DvT5Rc28tK k1GktqUQ==; Original-Received: from [::1] (port=49668 helo=whuk14.whukhost.com) by whuk14.whukhost.com with esmtpa (Exim 4.97.1) (envelope-from ) id 1suZRX-000000037R0-27HM; Sat, 28 Sep 2024 16:33:11 +0100 In-Reply-To: <86o7486u3z.fsf@gnu.org> X-Sender: hugo@heagren.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - whuk14.whukhost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heagren.com X-Get-Message-Sender-Via: whuk14.whukhost.com: authenticated_id: hugo@heagren.com X-Authenticated-Sender: whuk14.whukhost.com: hugo@heagren.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292582 Archived-At: --=_dbc61c6def83ef56a0159613aa6373a9 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed Hi all, sorry, I was working on this last night , had the patch sorted, and then somehow my browser crashed and I couldn't get to my email. Apologies for all the delays. > Rewriting a whole new `key-translate-selection-function` function for > that is not significantly easier than rewriting a whole new > `key-translate-remove`, so I think this is firmly in the > overengineering > side of the camp. Fair enough, I've got rid of the defcustom. > You can't trust `get-text-property` here (especially since you don't > even force `completing-read` to `require-match`). > Instead you should do something like `key-parse`. Good spot. > In the case of `key-translate-remove` I don't expect the arg to be > a literal constant in the code, so "nice/uniform syntax to write the > argument value" shouldn't be a concern. 🙂 Nice, removing the defcustom makes the whole thing simpler anyway. The way it works now is that `key-select-translation' returns a string (which passes `key-valid-p'). I went with this because then it's very straightforward to pass the result to `key-translate' in `key-translate-remove'. The alternative would be to parse a key vector out of the string at the end of `key-select-translation', but then immediately convert this back into a string (a string like the one I went with in the end) in the interactive form of `key-translate-remove'. New patch attached. Hugo --=_dbc61c6def83ef56a0159613aa6373a9 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Add-commands-to-interactively-set-unset-keyboard-tra.patch Content-Disposition: attachment; filename=0001-Add-commands-to-interactively-set-unset-keyboard-tra.patch;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YXAtLWNoZWNrIHRvKSkKQEAgLTQxNyw2ICs0MjQsNDggQEAga2V5LXRyYW5zbGF0 ZQogICAgICAgICAgIChhcmVmIGZyb20ta2V5IDApCiAgICAgICAgICAgKGFuZCB0byAoYXJlZiB0 by1rZXkgMCkpKSkpCiAKKyhkZWZ1biBrZXktc2VsZWN0LXRyYW5zbGF0aW9uICgpCisgICJQcm9t cHQgZm9yIGEgY3VycmVudCBrZXlib2FyZCB0cmFuc2xhdGlvbiBwYWlyIHdpdGggYCdjb21wbGV0 aW5nLXJlYWQnLgorCitFYWNoIHBhaXIgaXMgZm9ybWF0dGVkIGFzIFwiRlJPTSAtPiBUT1wiLgor CitSZXR1cm4gdGhlIFwiRlJPTVwiIGFzIGEga2V5IHN0cmluZy4iCisgIChsZXQqICgobWluaWJ1 ZmZlci1hbGxvdy10ZXh0LXByb3BlcnRpZXMgdCkKKyAgICAgICAgIChjb2xsZWN0aW9uKQorICAg ICAgICAgOzsgQWxpZ25tZW50IGhlbHBlcnMKKyAgICAgICAgIChwYWQgMCkKKyAgICAgICAgIChf IChtYXAtY2hhci10YWJsZQorICAgICAgICAgICAgIChsYW1iZGEgKGsgXykKKyAgICAgICAgICAg ICAgICh3aGVuICg+IChsZW5ndGggKGtleS1kZXNjcmlwdGlvbiBgWyxrXSkpIHBhZCkKKyAgICAg ICAgICAgICAgICAgKHNldHEgcGFkIChsZW5ndGggKGtleS1kZXNjcmlwdGlvbiBgWyxrXSkpKSkp CisgICAgICAgICAgICAga2V5Ym9hcmQtdHJhbnNsYXRlLXRhYmxlCisgICAgICAgICAgICAgKSkK KyAgICAgICAgIChmb3JtYXQtZnVuYworICAgICAgICAgIChsYW1iZGEgKGsgdikKKyAgICAgICAg ICAgIChzZXRxIGNvbGxlY3Rpb24KKyAgICAgICAgICAgICAgICAgIChjb25zCisgICAgICAgICAg ICAgICAgICAgKHByb3BlcnRpemUKKyAgICAgICAgICAgICAgICAgICAgKGZvcm1hdAorICAgICAg ICAgICAgICAgIC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