GNU bug report logs - #22673
execute-kbd-macro doesn't handle strings with characters in range (0x80..0xFF) correctly

Previous Next

Package: emacs;

Reported by: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>

Date: Mon, 15 Feb 2016 06:27:02 UTC

Severity: minor

Tags: notabug

Found in version 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 22673 in the body.
You can then email your comments to 22673 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-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 06:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 15 Feb 2016 06:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 02:10:58 +0000
[Message part 1 (text/plain, inline)]
Evaluate the following

   (global-set-key (kbd "C-x g neg") "¬")

Now use it, and instead of getting neg, you get the error:

   After 0 kbd macro iterations: user-error: No M-x tags-search or M-x
tags-query-replace in progress








In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.2)
 of 2015-10-24 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11703000
System Description: Debian GNU/Linux testing (stretch)

Configured using:
 `configure --build 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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build 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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  dirtrack-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
uncompressing utf-7.el.gz...done
Note: file is write protected
End of buffer [3 times]
Mark set
Making completion list...
Quit [2 times]
Making completion list...
Mark set
C-c M-w is undefined
Mark activated

Load-path shadows:
/usr/share/emacs/24.5/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides
/usr/share/emacs/24.5/lisp/language/thai-word

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils dired pcmpl-gnu thai-util thai-word jka-compr
iso-transl pcmpl-unix rect mule-util ispell misearch multi-isearch
help-mode vc-git dirtrack shell pcomplete info package epg-config
wheatgrass-theme slime-fancy slime-trace-dialog slime-fontifying-fu
slime-package-fu slime-references slime-compiler-notes-tree
slime-scratch slime-presentations advice bridge slime-mdot-fu
slime-enclosing-context slime-fuzzy slime-fancy-trace
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
eldoc slime-repl elp slime-parse slime byte-opt bytecomp byte-compile
cconv derived cl-extra help-fns gud apropos compile etags arc-mode
archive-mode noutline outline easy-mmode easymenu pp comint ansi-color
ring hyperspec cl-macs thingatpt browse-url cl gv slime-autoloads
edmacro kmacro cl-loaddefs cl-lib time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 538849 23698)
  (symbols 48 36343 0)
  (miscs 40 791 842)
  (strings 32 89094 14725)
  (string-bytes 1 2124898)
  (vectors 16 31542)
  (vector-slots 8 1464374 205774)
  (floats 8 108 762)
  (intervals 56 18016 1613)
  (buffers 960 28)
  (heap 1024 100326 1595))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 08:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Alexis <flexibeast <at> gmail.com>
To: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>
Cc: 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 19:44:24 +1100
Thomas Lynch <thomas.lynch <at> reasoningtechnology.com> writes:

> Evaluate the following
>
>    (global-set-key (kbd "C-x g neg") "¬")
>
> Now use it, and instead of getting neg, you get the error:
>
>    After 0 kbd macro iterations: user-error: No M-x tags-search 
>    or M-x 
> tags-query-replace in progress

Are you wanting to use 'C-x g neg' to insert the symbol "¬" into 
the buffer? If so, you'll need to create a command for 
`global-set-key` to call, which does the insertion, e.g.

   (global-set-key (kbd "C-x g neg")
                   (lambda () 
                     (interactive) (insert "¬")))

If this is not what you're after, could you please explain further 
what you're trying to do?


Alexis.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 10:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>
Cc: 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 11:20:28 +0100
Thomas Lynch <thomas.lynch <at> reasoningtechnology.com> writes:

> Evaluate the following
>
>    (global-set-key (kbd "C-x g neg") "¬")

This is the same as binding [?\C-x ?g ?n ?e ?g] to [?\M-,].  You should
use the vector notation instead:

(global-set-key (kbd "C-x g neg") [?¬])

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 12:43:01 GMT) Full text and rfc822 format available.

Message #14 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Alexis <flexibeast <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 23:42:29 +1100
Andreas Schwab <schwab <at> suse.de> writes:

> Thomas Lynch <thomas.lynch <at> reasoningtechnology.com> writes:
>
>> Evaluate the following
>>
>>    (global-set-key (kbd "C-x g neg") "¬")
>
> This is the same as binding [?\C-x ?g ?n ?e ?g] to [?\M-,].  You 
> should use the vector notation instead:
>
> (global-set-key (kbd "C-x g neg") [?¬])

Neat!

The documentation for the `global-set-key` function, at least in 
24.5.3 and in the emacs-25 branch as at d9ea7950, doesn't mention 
this possibility:

   (global-set-key KEY COMMAND) 

   Give KEY a global binding as COMMAND.  COMMAND is the command 
   definition to use; usually it is a symbol naming an 
   interactively-callable function.

Perhaps it should be modified to refer to COMMAND-OR-VECTOR?


Alexis.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 13:04:02 GMT) Full text and rfc822 format available.

Message #17 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Alexis <flexibeast <at> gmail.com>
Cc: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 14:03:00 +0100
Alexis <flexibeast <at> gmail.com> writes:

> The documentation for the `global-set-key` function, at least in 24.5.3
> and in the emacs-25 branch as at d9ea7950, doesn't mention this
> possibility:
>
>    (global-set-key KEY COMMAND) 
>
>    Give KEY a global binding as COMMAND.  COMMAND is the command
> definition to use; usually it is a symbol naming an
> interactively-callable function.
>
> Perhaps it should be modified to refer to COMMAND-OR-VECTOR?

A vector is a kind of command.  It's a keyboard macro.

ELISP> (commandp [?¬])
t

For non-interactive use, define-key is preferred, which has all details.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Mon, 15 Feb 2016 13:25:01 GMT) Full text and rfc822 format available.

Message #20 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Alexis <flexibeast <at> gmail.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Mon, 15 Feb 2016 13:24:47 +0000
[Message part 1 (text/plain, inline)]
Note that every other character appears to work with this same syntax that
neg doesn't,  take for example:

(global-set-key (kbd "C-x g > =") "≥")

That and every other character in quotes that I have tried, works fine.
Only neg is different.

On Mon, Feb 15, 2016 at 1:03 PM, Andreas Schwab <schwab <at> suse.de> wrote:

> Alexis <flexibeast <at> gmail.com> writes:
>
> > The documentation for the `global-set-key` function, at least in 24.5.3
> > and in the emacs-25 branch as at d9ea7950, doesn't mention this
> > possibility:
> >
> >    (global-set-key KEY COMMAND)
> >
> >    Give KEY a global binding as COMMAND.  COMMAND is the command
> > definition to use; usually it is a symbol naming an
> > interactively-callable function.
> >
> > Perhaps it should be modified to refer to COMMAND-OR-VECTOR?
>
> A vector is a kind of command.  It's a keyboard macro.
>
> ELISP> (commandp [?¬])
> t
>
> For non-interactive use, define-key is preferred, which has all details.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab <at> suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Wed, 06 Jun 2018 00:04:01 GMT) Full text and rfc822 format available.

Message #23 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Tue, 05 Jun 2018 20:02:53 -0400
retitle 22673 execute-kbd-macro doesn't handle strings with characters in range (0x80..0xFF) correctly
quit

Andreas Schwab <schwab <at> suse.de> writes:

> Thomas Lynch <thomas.lynch <at> reasoningtechnology.com> writes:
>
>> Evaluate the following
>>
>>    (global-set-key (kbd "C-x g neg") "¬")

A more straightforward way is (execute-kbd-macro "¬").  Use

(setq debug-ignored-errors (remq 'user-error debug-ignored-errors)
      debug-on-error t)

to get a backtrace.

> This is the same as binding [?\C-x ?g ?n ?e ?g] to [?\M-,].  You should
> use the vector notation instead:
>
> (global-set-key (kbd "C-x g neg") [?¬])

(execute-kbd-macro [?¬]) works, but shouldn't the string version work
too?  I see that it fails because of this statement in keyboard.c:

      c = Faref (Vexecuting_kbd_macro, make_number (executing_kbd_macro_index));
      if (STRINGP (Vexecuting_kbd_macro)
          && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff))
        XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));

Which transforms ?¬ (aka #xac) into #x800002c == (event-convert-list '(meta ?,))





Changed bug title to 'execute-kbd-macro doesn't handle strings with characters in range (0x80..0xFF) correctly' from '24.5; global set key neg freaks out emacs' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 06 Jun 2018 00:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Wed, 06 Jun 2018 07:40:02 GMT) Full text and rfc822 format available.

Message #28 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: 24.5; global set key neg freaks out emacs
Date: Wed, 06 Jun 2018 09:39:27 +0200
On Jun 05 2018, Noam Postavsky <npostavs <at> gmail.com> wrote:

> (execute-kbd-macro [?¬]) works, but shouldn't the string version work
> too?  I see that it fails because of this statement in keyboard.c:

Strings as key sequence are legacy and can only contain ASCII and
Meta-ASCII characters.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Sat, 29 Jan 2022 17:00:02 GMT) Full text and rfc822 format available.

Message #31 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> suse.de>
Cc: Thomas Lynch <thomas.lynch <at> reasoningtechnology.com>,
 Noam Postavsky <npostavs <at> gmail.com>, 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: execute-kbd-macro doesn't handle strings with
 characters in range (0x80..0xFF) correctly
Date: Sat, 29 Jan 2022 17:59:10 +0100
Andreas Schwab <schwab <at> suse.de> writes:

>> (execute-kbd-macro [?¬]) works, but shouldn't the string version work
>> too?  I see that it fails because of this statement in keyboard.c:
>
> Strings as key sequence are legacy and can only contain ASCII and
> Meta-ASCII characters.

So I guess there's nothing to fix here, and I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 29 Jan 2022 17:00:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 22673 <at> debbugs.gnu.org and Thomas Lynch <thomas.lynch <at> reasoningtechnology.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 29 Jan 2022 17:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22673; Package emacs. (Sat, 29 Jan 2022 18:02:02 GMT) Full text and rfc822 format available.

Message #38 received at 22673 <at> debbugs.gnu.org (full text, mbox):

From: Thomas Walker Lynch <thomas.lynch <at> reasoningtechnology.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Andreas Schwab <schwab <at> suse.de>, Noam Postavsky <npostavs <at> gmail.com>,
 22673 <at> debbugs.gnu.org
Subject: Re: bug#22673: execute-kbd-macro doesn't handle strings with
 characters in range (0x80..0xFF) correctly
Date: Sat, 29 Jan 2022 19:01:05 +0100
[Message part 1 (text/plain, inline)]
It has been so long that I only vaguely remember it in the first place.
That is one way to make a bug report moot.  LOL

On Sat, Jan 29, 2022 at 5:59 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Andreas Schwab <schwab <at> suse.de> writes:
>
> >> (execute-kbd-macro [?¬]) works, but shouldn't the string version work
> >> too?  I see that it fails because of this statement in keyboard.c:
> >
> > Strings as key sequence are legacy and can only contain ASCII and
> > Meta-ASCII characters.
>
> So I guess there's nothing to fix here, and I'm closing this bug report.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 27 Feb 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 124 days ago.

Previous Next


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