unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: hugo@heagren.com, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 72460@debbugs.gnu.org
Subject: bug#72460: [patch] add commands for setting keyboard translations interactively
Date: Sat, 31 Aug 2024 11:08:02 +0300	[thread overview]
Message-ID: <86o759cdy5.fsf@gnu.org> (raw)
In-Reply-To: <jwv1q2ktxkf.fsf-monnier+emacs@gnu.org> (bug-gnu-emacs@gnu.org)

Ping! Hugo, can you please respond to Stefan's review comments, so we
could make progress here?

> Cc: 72460@debbugs.gnu.org
> Date: Mon, 19 Aug 2024 10:42:43 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> > I find this sort of thing useful for cases where I want to use
> > something other than space as a word separator (e.g. when typing lots
> > of function names), or when for a long period I want to use the symbol
> > which is usually on the shift of a key (i.e. I know I want to type "+"
> > a lot, but not "=").
> 
> Interesting.  I can see that `keyboard-translate-table` is indeed
> a cheap way to implement it.
> 
> [ This said, it applies at a very low level (directly inside
>   `read-event`) and only to "characters" (e.g. not to the `tab` or
>   `return` keys), which can make it both maybe too powerful and yet not
>   flexible enough.  ]
> 
> > +  (interactive `(,(key-description `[,(read-char "From: ")])
> > +                 ,(key-description `[,(read-char "To: ")])))
> 
> [ Personally, I'd add a comment lamenting the fact that `keymap-*`
>   functions force us to use `key-description` here only for that to be
>   undone by `key-parse`.  ]
> 
> > +(defcustom key-translate-selection-function #'key-select-translation
> 
> Do we need this?
> 
> > +pair in `keyboard-translate-table', and return a vector containing only
> > +the FROM key of the selected pair (e.g. if the selected pair translates
> > +\"=\" to \"+\", the function should return the vector [61])"
> 
> Why not return just the char rather than a vector containing the char?
> 
> > +(defun key-translate-remove (from)
> > +  "Remove translation of FROM from `keyboard-translate-table'.
> > +
> > +FROM must satisfy `key-valid-p'.  If FROM has no entry in
> > +`keyboard-translate-table', this has no effect."
> > +  (interactive (list (key-description
> > +                      (funcall key-translate-selection-function))))
> > +  (set-char-table-range
> > +   keyboard-translate-table (aref (key-parse from) 0) nil))
> 
> If FROM maps to a sequence of length != 1, we'll either signal an ugly
> error or silently ignore the rest.
> Any reason why you didn't make FROM be a simple character?
> 
> 
>         Stefan
> 
> 
> 
> 
> 





  reply	other threads:[~2024-08-31  8:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-04 12:16 bug#72460: [patch] add commands for setting keyboard translations interactively hugo
2024-08-17  8:46 ` Eli Zaretskii
2024-08-19 14:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-31  8:08   ` Eli Zaretskii [this message]
     [not found]   ` <ed0eede1b3ac4e6da54c2449e3c8ea4f@heagren.com>
2024-08-31 13:56     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14  7:38       ` Eli Zaretskii
2024-09-28  8:49         ` Eli Zaretskii
2024-09-28 15:33           ` hugo
2024-09-28 16:02             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03  2:45               ` hugo
2024-10-03 15:56                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=86o759cdy5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72460@debbugs.gnu.org \
    --cc=hugo@heagren.com \
    --cc=monnier@iro.umontreal.ca \
    /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).