GNU bug report logs - #6080
Behaviour of `char-syntax' changes when byte-compiled

Previous Next

Package: emacs;

Reported by: Toby Cubitt <toby-dated-1274008215.7ce38e <at> dr-qubit.org>

Date: Sun, 2 May 2010 12:28:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Toby Cubitt <toby-dated-1274124074.5dc0e6 <at> dr-qubit.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 6080 <at> debbugs.gnu.org
Subject: Re: bug#6080: Behaviour of `char-syntax' changes when byte-compiled
Date: Mon, 3 May 2010 20:26:14 +0100
On Mon, May 03, 2010 at 01:05:40PM -0400, Stefan Monnier wrote:
> >   (defun test ()
> >     (let ((char 33554464))
> >       (message "char: %s" char)
> >       (message "syntax: %s" (char-syntax char)))
> >     nil)
> 
> > (Note that 33554464 is the value of `last-input-event' when a command is
> > invoked by the key sequence "S-<SPC>".)
> 
> > When the test function is evalled and then run with "M-: (test)", it
> > outputs the following in the *Messages* buffer:
> 
> > char: 33554464
> > syntax: 32
> > nil
> 
> That's an error: S-SPC is not a char, so the function should signal
> an error.

Good to know which is considered the correct behaviour.

> > When the test function is byte-compiled, loaded, and run as before with
> > "M-: (test)", it throws an error and produces the following backtrace:
> 
> Yes, oddly enough (it probably made sense at some point, of course, but
> that point was passed a very long time ago), char-syntax has its own
> byte code, so what happens above is that the byte-code version of
> char-syntax is not implemented in the exact same way as
> char-syntax function.

Interesting! So the byte-compiler replaces a char-syntax call with
hand-crafted byte-code, and bypasses the version in syntax.c entirely?

Will you fix the char-syntax function so that it signals an error in this
case? If so, then I won't bother working around this Emacs bug, as it was
a minor issue and I can just tell people to byte-compile to fix it.

Toby
-- 
Dr T. S. Cubitt
Quantum Information Theory group
Department of Mathematics
University of Bristol
United Kingdom

email: tsc25 <at> cantab.net
web: www.dr-qubit.org




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

Previous Next


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