all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Shynur Xie <one.last.kiss@outlook.com>
To: 65735@debbugs.gnu.org
Subject: bug#65735: [PATCH] key-translate should use the 1st key of a key sequence
Date: Mon, 4 Sep 2023 15:46:32 +0000	[thread overview]
Message-ID: <PH0PR11MB74703464C60A5D955DC09957D7E9A@PH0PR11MB7470.namprd11.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

To make 

    (key-translate "C-x" "<control-x>")
    ;; this is an example in elisp manual 

work.

[-- Attachment #2: 0001-key-translate-uses-the-1st-key-of-a-key-sequence.patch --]
[-- Type: application/octet-stream, Size: 1386 bytes --]

From 856bd7a0c696d0ff22e62d70688b287a8214dcda Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@outlook.com>
Date: Mon, 4 Sep 2023 23:37:33 +0800
Subject: [PATCH] `key-translate' uses the 1st key of a key sequence

---
 lisp/keymap.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/keymap.el b/lisp/keymap.el
index 017b2d6..5a4021a 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -378,7 +378,7 @@ which is
 This function creates a `keyboard-translate-table' if necessary
 and then modifies one entry in it.
 
-Both KEY 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'."
   (declare (compiler-macro
             (lambda (form) (keymap--compile-check from to) form)))
   (keymap--check from)
@@ -386,7 +386,9 @@ Both KEY and TO should be specified by strings that satisfy `key-valid-p'."
   (or (char-table-p keyboard-translate-table)
       (setq keyboard-translate-table
 	    (make-char-table 'keyboard-translate-table nil)))
-  (aset keyboard-translate-table (key-parse from) (key-parse to)))
+  (aset keyboard-translate-table
+        (aref (key-parse from) 0)
+        (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.41.0.windows.3


             reply	other threads:[~2023-09-04 15:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 15:46 Shynur Xie [this message]
2023-09-07  7:54 ` bug#65735: [PATCH] key-translate should use the 1st key of a key sequence Robert Pluim
2023-09-07  8:15   ` Eli Zaretskii
2023-09-07 11:57     ` Robert Pluim
2023-09-07 13:09       ` Eli Zaretskii
2023-09-07 14:01         ` Stefan Kangas
2023-09-18  9:49           ` Robert Pluim
2023-09-07 13:42       ` Shynur Xie
2023-09-07 13:49         ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR11MB74703464C60A5D955DC09957D7E9A@PH0PR11MB7470.namprd11.prod.outlook.com \
    --to=one.last.kiss@outlook.com \
    --cc=65735@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.