From unknown Sat Jun 14 19:39:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6080: Behaviour of `char-syntax' changes when byte-compiled Resent-From: Toby Cubitt Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2010 12:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6080 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6080@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: Toby Cubitt Received: via spool by submit@debbugs.gnu.org id=B.1272803280476 (code B ref -1); Sun, 02 May 2010 12:28:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 May 2010 12:28:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8YH9-00007c-5h for submit@debbugs.gnu.org; Sun, 02 May 2010 08:28:00 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8X49-0007Pb-S0 for submit@debbugs.gnu.org; Sun, 02 May 2010 07:10:30 -0400 Received: from lists.gnu.org ([199.232.76.165]:34937) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1O8X44-0004k5-8v for submit@debbugs.gnu.org; Sun, 02 May 2010 07:10:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8X43-0006IS-OO for bug-gnu-emacs@gnu.org; Sun, 02 May 2010 07:10:23 -0400 Received: from [140.186.70.92] (port=53000 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8X42-0006IE-Ds for bug-gnu-emacs@gnu.org; Sun, 02 May 2010 07:10:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.0 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8X3z-0001VG-IS for bug-gnu-emacs@gnu.org; Sun, 02 May 2010 07:10:22 -0400 Received: from mail.geekisp.com ([216.168.135.169]:41926 helo=starfish.geekisp.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8X3z-0001V4-D6 for bug-gnu-emacs@gnu.org; Sun, 02 May 2010 07:10:19 -0400 Received: (qmail 31267 invoked by uid 1003); 2 May 2010 11:10:16 -0000 Received: from c3po (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Sun, 02 May 2010 07:10:12 -0400 Date: Sun, 2 May 2010 12:15:17 +0100 Message-ID: <20100502111517.GA29594@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Fcc: ~/.offlineimap/GeekISP/INBOX/Sent/ User-Agent: Mutt/1.5.20 (2009-06-14) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.0-3.4 (scrub) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.6 (------) X-Mailman-Approved-At: Sun, 02 May 2010 08:27:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) Define the following test function: (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-".) 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 When the test function is byte-compiled, loaded, and run as before with "M-: (test)", it throws an error and produces the following backtrace: Debugger entered--Lisp error: (wrong-type-argument characterp 33554464) test() eval((test)) eval-expression((test) nil) call-interactively(eval-expression nil nil) This is with a recent VCS Emacs checkout. Emacs version and settings are included below. Toby In GNU Emacs 23.1.96.1 (i686-pc-linux-gnu, GTK+ Version 2.18.6) of 2010-04-23 on c3po Windowing system distributor `The X.Org Foundation', version 11.0.10706000 configured using `configure '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-23-vcs' '--infodir=/usr/share/info/emacs-23-vcs' '--with-sound' '--with-x' '--without-gconf' '--with-toolkit-scroll-bars' '--without-gif' '--without-jpeg' '--with-png' '--with-rsvg' '--without-tiff' '--with-xpm' '--with-xft' '--without-libotf' '--without-m17n-flt' '--with-x-toolkit=gtk' '--without-hesiod' '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus' '--build=i686-pc-linux-gnu' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CFLAGS=-march=prescott -O2 -pipe' 'LDFLAGS=-Wl,-O1'' Important settings: value of $LC_ALL: en_GB.UTF-8 value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_GB.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Features: (conf-mode newcomment shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils emacsbug iso-transl info pp cl-specs edebug thingatpt cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs easy-mmode compile comint ring multi-isearch vc-git find-func help-mode view debug server which-func imenu paren advice advice-preload post help-fns derived cl cl-19 css-mode-simple edmacro kmacro regexp-opt undo-tree log-modification-mode show-point-mode predictive-html auto-overlay-flat predictive-texinfo predictive-latex predictive-auto-overlay-auto-dict auto-overlay-nested auto-overlay-self auto-overlay-line auto-overlay-word predictive timerfunctions auto-overlays auto-overlay-common dict-tree trie cedet-edebug tNFA queue heap avl-tree semantic/util-modes easymenu semantic/util semantic semantic/tag semantic/lex semantic/fw eieio byte-opt bytecomp byte-compile mode-local cedet completion-ui-sources completion-ui-menu completion-ui-tooltip completion-ui-echo completion-ui-hotkeys completion-ui-dynamic completion-ui-popup-frame completion-ui flyspell ispell avoid site-gentoo preview-latex tex-site auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind font-render-setting gtk x-toolkit x multi-tty emacs) -- Dr T. S. Cubitt Quantum Information Theory group Department of Mathematics University of Bristol United Kingdom email: tsc25@cantab.net web: www.dr-qubit.org From unknown Sat Jun 14 19:39:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6080: Behaviour of `char-syntax' changes when byte-compiled Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 May 2010 17:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6080 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Toby Cubitt Cc: 6080@debbugs.gnu.org Received: via spool by 6080-submit@debbugs.gnu.org id=B6080.127290635016799 (code B ref 6080); Mon, 03 May 2010 17:06:01 +0000 Received: (at 6080) by debbugs.gnu.org; 3 May 2010 17:05:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8z5a-0004Mu-4u for submit@debbugs.gnu.org; Mon, 03 May 2010 13:05:50 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8z5X-0004Mo-UO for 6080@debbugs.gnu.org; Mon, 03 May 2010 13:05:48 -0400 Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o43H5eqs030518; Mon, 3 May 2010 13:05:40 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 3CD11B4C27; Mon, 3 May 2010 13:05:40 -0400 (EDT) From: Stefan Monnier Message-ID: References: <20100502111517.GA29594@c3po> Date: Mon, 03 May 2010 13:05:40 -0400 In-Reply-To: <20100502111517.GA29594@c3po> (Toby Cubitt's message of "Sun, 2 May 2010 12:15:17 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3526=0 X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > (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-".) > 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. > 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. Stefan From unknown Sat Jun 14 19:39:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6080: Behaviour of `char-syntax' changes when byte-compiled References: <20100502111517.GA29594@c3po> Resent-From: Toby Cubitt Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 May 2010 19:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6080 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 6080@debbugs.gnu.org Received: via spool by 6080-submit@debbugs.gnu.org id=B6080.127291503920979 (code B ref 6080); Mon, 03 May 2010 19:31:01 +0000 Received: (at 6080) by debbugs.gnu.org; 3 May 2010 19:30:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O91Li-0005SK-Cx for submit@debbugs.gnu.org; Mon, 03 May 2010 15:30:38 -0400 Received: from mail.geekisp.com ([216.168.135.169] helo=starfish.geekisp.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O91Ch-0005Nk-OV for 6080@debbugs.gnu.org; Mon, 03 May 2010 15:21:20 -0400 Received: (qmail 28001 invoked by uid 1003); 3 May 2010 19:21:14 -0000 Received: from c3po (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Mon, 03 May 2010 15:21:07 -0400 Date: Mon, 3 May 2010 20:26:14 +0100 Message-ID: <20100503192614.GA22641@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Fcc: ~/.offlineimap/GeekISP/INBOX/Sent/ User-Agent: Mutt/1.5.20 (2009-06-14) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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-".) > > > 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. [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 BAYES_50 BODY: Bayesian spam probability is 40 to 60% [score: 0.4978] 2.0 FAKE_REPLY_C FAKE_REPLY_C X-Mailman-Approved-At: Mon, 03 May 2010 15:30:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.7 (/) 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-".) > > > 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@cantab.net web: www.dr-qubit.org From unknown Sat Jun 14 19:39:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6080: Behaviour of `char-syntax' changes when byte-compiled Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 May 2010 17:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6080 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Toby Cubitt Cc: 6080@debbugs.gnu.org Received: via spool by 6080-submit@debbugs.gnu.org id=B6080.127308206326116 (code B ref 6080); Wed, 05 May 2010 17:55:02 +0000 Received: (at 6080) by debbugs.gnu.org; 5 May 2010 17:54:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9inf-0006nB-4A for submit@debbugs.gnu.org; Wed, 05 May 2010 13:54:23 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9ine-0006n4-9Y for 6080@debbugs.gnu.org; Wed, 05 May 2010 13:54:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFtN4UvO+IB1/2dsb2JhbACdTHK/CIUTBIws X-IronPort-AV: E=Sophos;i="4.52,335,1270440000"; d="scan'208";a="63481166" Received: from 206-248-128-117.dsl.teksavvy.com (HELO pastel.home) ([206.248.128.117]) by ironport2-out.pppoe.ca with ESMTP; 05 May 2010 13:54:17 -0400 Received: by pastel.home (Postfix, from userid 20848) id 2559C814C; Wed, 5 May 2010 13:54:17 -0400 (EDT) From: Stefan Monnier Message-ID: References: <20100503192614.GA22641@c3po> Date: Wed, 05 May 2010 13:54:17 -0400 In-Reply-To: <20100503192614.GA22641@c3po> (Toby Cubitt's message of "Mon, 3 May 2010 20:26:14 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > Will you fix the char-syntax function so that it signals an error in this > case? I've just installed such a change, Stefan --- src/syntax.c 2010-03-10 14:45:21 +0000 +++ src/syntax.c 2010-05-05 17:20:27 +0000 @@ -858,7 +858,7 @@ Lisp_Object character; { int char_int; - CHECK_NUMBER (character); + CHECK_CHARACTER (character); char_int = XINT (character); SETUP_BUFFER_SYNTAX_TABLE (); return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); From debbugs-submit-bounces@debbugs.gnu.org Thu May 06 09:22:38 2010 Received: (at control) by debbugs.gnu.org; 6 May 2010 13:22:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OA12E-0002TX-0v for submit@debbugs.gnu.org; Thu, 06 May 2010 09:22:38 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OA12C-0002TQ-N4 for control@debbugs.gnu.org; Thu, 06 May 2010 09:22:36 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AocGAJhf4kvO+IB1/2dsb2JhbACROYwucr0thRMEjDA X-IronPort-AV: E=Sophos;i="4.52,341,1270440000"; d="scan'208";a="63569928" Received: from 206-248-128-117.dsl.teksavvy.com (HELO alfajor.home) ([206.248.128.117]) by ironport2-out.pppoe.ca with ESMTP; 06 May 2010 09:22:26 -0400 Received: by alfajor.home (Postfix, from userid 20848) id 7E77EAF455; Thu, 6 May 2010 09:22:26 -0400 (EDT) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: bug#6080: Behaviour of `char-syntax' changes when byte-compiled Message-ID: References: <20100506011514.GA391@c3po> Date: Thu, 06 May 2010 09:22:26 -0400 In-Reply-To: <20100506011514.GA391@c3po> (Toby Cubitt's message of "Thu, 6 May 2010 02:15:14 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) close 6080 thanks