unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Shynur Xie <one.last.kiss@outlook.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: "65735@debbugs.gnu.org" <65735@debbugs.gnu.org>
Subject: bug#65735: [PATCH] key-translate should use the 1st key of a key sequence
Date: Thu, 7 Sep 2023 13:42:18 +0000	[thread overview]
Message-ID: <PH0PR11MB7470D824A0039F9D860965BBD7EEA@PH0PR11MB7470.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87a5tyfb6t.fsf@gmail.com>

> Robert:
> Perhaps we should also check that `from' and `to' specify single
> keys, although that might be overkill.

Not necessary IMO.
As a regular Emacs user, I would read its docstring before using this
function; the docstring already explains how to use it very clearly.
Moreover, there're several examples in the elisp manual for reference:

   +----------------------------------------------------+
   | -- Function: key-translate from to                 |
   |     ... ...                                        |
   |   Here’s an example of ...                         |
   |     (key-translate "C-x" "<control-x>")            |
   |     (keymap-global-set "<control-x>" 'kill-region) |
   +----------------------------------------------------+

> Robert:
> do you have a copyright assignment on file?

Yes.

> Robert:
> --- i/lisp/simple.el
> +++ w/lisp/simple.el

> - (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"))))

The docstring of `keyboard-translate' does suggest using
`key-translate'; similarly, `define-key' suggests using `keymap-set'.

FWIW, I noticed that there're also some `define-key' invocations in
the file "lisp/simple.el".




  parent reply	other threads:[~2023-09-07 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 15:46 bug#65735: [PATCH] key-translate should use the 1st key of a key sequence Shynur Xie
2023-09-07  7:54 ` 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=PH0PR11MB7470D824A0039F9D860965BBD7EEA@PH0PR11MB7470.namprd11.prod.outlook.com \
    --to=one.last.kiss@outlook.com \
    --cc=65735@debbugs.gnu.org \
    --cc=rpluim@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).