[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#3907: bad result for insert-kbd-macro
From: |
Stefan Monnier |
Subject: |
bug#3907: bad result for insert-kbd-macro |
Date: |
Thu, 23 Jul 2009 17:55:00 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) |
> I created a macro and called insert-kbd-macro on it. This is the
> result:
> (fset 'allegati
> [?e ?\C-[ ?< ?\C-s ?t ?e ?x ?t ?/ ?h ?t ?m ?l ?\C-m ?\C-[ ?{ ?\C-[ ?{
> ?\C-[ ?} ?\C-x ?q ?\C-[ ?x ?k ?e ?e ?p ?\C-m ?f ?i ?l ?e ?n ?a ?m ?e ?= ?\C-m
> ?\C-m ?\C-m ?\C-[ ?% ?. ?* ?f ?i ?l ?e ?n ?a ?m ?e ?= ?\" ?\\ ?( ?[ ?^ ?\" ?]
> ?+ ?\\ ?) ?\" ?\C-m ? ?[ ? ?\\ ?1 ? ?] ?\C-m ?! ?\C-m ?\C-m ?\C-m ?\C-x ?q
> ?\C-c ?\C-c ?o ?\C-[ ?\C-? ?i ?s ?i ?\C-m ?\C-[ ?p ? ?d ?\C-[ ?> up ?\C-c
> ?\C-c ?\C-m])
> 1) first, if I go to the end of the macro and hit C-x C-e, it appears
> that the sexp is not correctly evaluated, as the parser sees
> unbalanced parentheses
This is a bug in the emacs-lisp-mode, mostly. But indeed, the printer
should also be more careful to escape the chars that cause problem for
the emacs-lisp-mode (i.e. print ?\[ rather than ?[ in your above
example).
This said, IIUC the printer used in Emacs-23 does pay attention this
problem and insert-kbd-macro gave me (for example):
(setq last-kbd-macro
[?a left ?\[])
so the problem seems to be fixed in Emacs-23. Can you confirm?
> 2) second, insert-kbd-macro used to write the strings between double
> quotes, which is generally more readable and allows for easy editing;
> I do not know wht it used the vector style here
There's an `up' symbol in there, which couldn't fit in a string.
In general an event is not a char any more (it used to be, back in the
tty days when bytes and chars were the same thing), so a sequence of
events should preferably always be represented as an array of events,
rather than as a string (although, insert-kbd-macro still appears to use
a string when possible).
Stefan