GNU bug report logs - #72460
[patch] add commands for setting keyboard translations interactively

Previous Next

Package: emacs;

Reported by: hugo <at> heagren.com

Date: Sun, 4 Aug 2024 12:18:02 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: hugo <at> heagren.com, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 72460 <at> debbugs.gnu.org
Subject: bug#72460: [patch] add commands for setting keyboard translations interactively
Date: Sat, 31 Aug 2024 11:08:02 +0300
Ping! Hugo, can you please respond to Stefan's review comments, so we
could make progress here?

> Cc: 72460 <at> 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 <at> 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
> 
> 
> 
> 
> 




This bug report was last modified 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.