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

> Cc: 72...@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
> 
> 
> 
> 
> 



  • bug#72460:... Eli Zaretskii
    • bug#7... Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply via email to