unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3907: bad result for insert-kbd-macro
@ 2009-07-23 16:04 Francesco Potorti`
  2009-07-23 21:55 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Potorti` @ 2009-07-23 16:04 UTC (permalink / raw)
  To: bug-gnu-emacs

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])

I see two problems here:

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

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


In GNU Emacs 22.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.16.4)
 of 2009-07-03 on nautilus, modified by Debian
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.3/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: it_IT@euro
  value of $LC_CTYPE: it_IT@euro
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: C
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  desktop-save-mode: t
  openwith-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
a SPC d e t t a g l i SPC d a SPC p o t r e DEL DEL 
e r n e SPC c o m i n c i a r e SPC a SPC d i s c u 
t e r e SPC s e r i a m n e DEL DEL DEL m e n t e . 
RET RET ESC O A ESC O A ESC O A ESC O B ESC O B ESC 
O B C I a o C-a ESC c ! C-c C-f C-f M a i TAB p e r 
s o TAB r a d i TAB RET C-c C-c SPC p SPC RET C-d p 
p p p p p p p p p ESC s f a g g i o l i RET d n n n 
n n n n n d n n d d d d d d d n x g f n e p a , SPC 
g i a n n e t t i ESC DEL DEL DEL C-c C-c SPC RET d 
x 8 1 j n n n n n q C-x b . e m a TAB RET ESC O A - 
v e c c h i o ESC O B ESC O B DEL DEL DEL a l l e g 
a t i ESC O B ESC O B ESC O B ESC O B ESC O B ESC O 
A ESC O D C-x C-e ESC O A ESC O A ESC O A C-a ESC C-f 
ESC O B ESC O B ESC O B ESC O A ESC O D C-x C-e ESC 
x r e p o r t SPC e m a TAB RET

Recent messages:
Sending...done
No following nondeleted message
Expunging deleted messages...done
Expunging deleted messages...done
Saving file /home/pot/Mail/RMAIL...
Wrote /home/pot/Mail/RMAIL
[112 32 100 27 62 up 3 3 13]
forward-sexp: Scan error: "Unbalanced parentheses", 2248, 21313
[112 32 100 27 62 up 3 3 13]
Loading emacsbug...done






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#3907: bad result for insert-kbd-macro
  2009-07-23 16:04 bug#3907: bad result for insert-kbd-macro Francesco Potorti`
@ 2009-07-23 21:55 ` Stefan Monnier
  2009-07-29 11:44   ` Francesco Potorti`
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2009-07-23 21:55 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: 3907

> 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#3907: bad result for insert-kbd-macro
  2009-07-23 21:55 ` Stefan Monnier
@ 2009-07-29 11:44   ` Francesco Potorti`
  0 siblings, 0 replies; 3+ messages in thread
From: Francesco Potorti` @ 2009-07-29 11:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 3907

>> 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?

Yes.  In fact, I thought I had tried in Emacs 23, but by error I was
running Emacs 22...

>> 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).

Right, thank you for the explanation.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-29 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 16:04 bug#3907: bad result for insert-kbd-macro Francesco Potorti`
2009-07-23 21:55 ` Stefan Monnier
2009-07-29 11:44   ` Francesco Potorti`

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).