bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67182: 29.1; read-kbd-macro always return a vector


From: Jakub T. Jankiewicz
Subject: bug#67182: 29.1; read-kbd-macro always return a vector
Date: Wed, 15 Nov 2023 14:20:55 +0100

Then maybe the documentation for the function should be updated and in
changelog there is should a note about this breaking change.

On Wed, 15 Nov 2023 07:45:16 -0500
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >> This is the code I was always using in Emacs to send raw keys
> >> to modes like ansi-term:
> >> 
> >> (defun raw (str)
> >>   (interactive "sSend Raw Key: ")
> >>   (term-send-raw-string (read-kbd-macro str)))
> >> 
> >> But this doesn't work anymore it throw an error [3] when calling:
> >> 
> >> (raw "C-c")  
> 
> The above code already threw the same error when you call
> 
>     (raw "C-<mouse-1>")
> or
>     (raw "M-a")
> or
>     (raw "é")
> 
> :-(
> 
> Maybe it should be something like
> 
>     (defun raw (str)
>       (interactive "sSend Raw Key: ")
>       (let ((keys (kbd str))
>             (string (condition-case err
>                         (concat "" keys)
>                       (wrong-type-argument
>                        (let ((elem (nth 2 err)))
>                          (error "%s is not a character"
>                                 (if (numberp elem)
>                                     (prin1-char elem)
>                                   elem)))))))
>         (term-send-raw-string string)))
> 
> ?
> 
> >> According to documentation `C-h f read-kbd-macro`
> >> "The result will be a string if possible" but it seems that in new
> >> GNU Emacs it's always a vector.  
> > Stefan, this is due to your change in edmacro-parse-keys as part of
> > commit 87789330, whose log message says nothing about
> > edmacro-parse-keys.  Did you really intend to make that
> > backward-incompatible change?  If so, why?  
> 
> Yes.  I want to eliminate the use of strings that stand for a sequence
> of events because it does nothing more than leave latent bugs and create
> confusion (between the strings used as input to `read-kbd-macro` and the
> strings that used to be output by `read-kbd-macro`), while increasing
> the complexity of the rest of the code which has to handle both vectors
> and strings.
> 
> 
>         Stefan
> 

--
Jakub T. Jankiewicz, Senior Front-End Developer
https://jcubic.pl/me
https://koduj.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]