GNU bug report logs - #3907
bad result for insert-kbd-macro

Previous Next

Package: emacs;

Reported by: Francesco Potorti` <pot <at> gnu.org>

Date: Thu, 23 Jul 2009 16:10:06 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3907 in the body.
You can then email your comments to 3907 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3907; Package emacs. (Thu, 23 Jul 2009 16:10:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Francesco Potorti` <pot <at> gnu.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 23 Jul 2009 16:10:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Francesco Potorti` <pot <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: bad result for insert-kbd-macro
Date: Thu, 23 Jul 2009 18:04:46 +0200
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 <at> euro
  value of $LC_CTYPE: it_IT <at> 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




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3907; Package emacs. (Fri, 24 Jul 2009 01:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 24 Jul 2009 01:40:05 GMT) Full text and rfc822 format available.

Message #10 received at 3907 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Francesco Potorti` <pot <at> gnu.org>
Cc: 3907 <at> debbugs.gnu.org
Subject: Re: bug#3907: bad result for insert-kbd-macro
Date: Thu, 23 Jul 2009 17:55:00 -0400
> 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



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3907; Package emacs. (Wed, 29 Jul 2009 11:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Francesco Potorti` <pot <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 29 Jul 2009 11:50:30 GMT) Full text and rfc822 format available.

Message #15 received at 3907 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Francesco Potorti` <pot <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 3907 <at> debbugs.gnu.org
Subject: Re: bug#3907: bad result for insert-kbd-macro
Date: Wed, 29 Jul 2009 13:44:56 +0200
>> 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.



bug closed, send any further explanations to Francesco Potorti` <pot <at> gnu.org> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sat, 15 Aug 2009 23:20:06 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Sun, 13 Sep 2009 14:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 279 days ago.

Previous Next


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