Subject: bug#65735: [PATCH] key-translate should use the 1st key of a key sequence

From: Robert Pluim <[email-masked]>
Date: Thu, 07 Sep 2023 13:57:14 +0200

>>>>> On Thu, 07 Sep 2023 11:15:44 +0300, Eli Zaretskii <[email-masked]> said:

    >> Cc: [email-masked]
    >> From: Robert Pluim <[email-masked]>
    >> Date: Thu, 07 Sep 2023 09:54:13 +0200
    >> 
    >> I see commits from you both with and without
    >> Copyright-paperwork-exempt, do you have a copyright assignment on
    >> file?

    Eli> He does, now.

OK. Then Iʼll push it to emacs-29, since otherwise `key-translate' is
completely useless.

In the interests of, uhm, eating our own dogfood, how about the
following as well for master (or should I let sleeping dogs lie 😺)

diff --git i/lisp/simple.el w/lisp/simple.el
index 05a3c4b93d6..da9db1685c4 100644
--- i/lisp/simple.el
+++ w/lisp/simple.el
@@ -10658,10 +10658,10 @@ normal-erase-is-backspace-mode
 	  (t
 	   (if enabled
 	       (progn
-		 (keyboard-translate ?\C-h ?\C-?)
-		 (keyboard-translate ?\C-? ?\C-d))
-	     (keyboard-translate ?\C-h ?\C-h)
-	     (keyboard-translate ?\C-? ?\C-?))))
+		 (key-translate "C-h" "DEL")
+		 (key-translate "DEL" "C-d"))
+	     (key-translate "C-h" "C-h")
+	     (key-translate "DEL" "DEL"))))
 
     (if (called-interactively-p 'interactive)
 	(message "Delete key deletes %s"
diff --git i/lisp/term/bobcat.el w/lisp/term/bobcat.el
index 983c8cded2f..2f611953523 100644
--- i/lisp/term/bobcat.el
+++ w/lisp/term/bobcat.el
@@ -3,8 +3,8 @@
 (defun terminal-init-bobcat ()
   "Terminal initialization function for bobcat."
   ;; HP terminals usually encourage using ^H as the rubout character
-  (keyboard-translate ?\177 ?\^h)
-  (keyboard-translate ?\^h ?\177))
+  (key-translate "DEL "C-h")
+  (key-translate "C-h "DEL"))
 
 (provide 'term/bobcat)

Robert
--