GNU bug report logs - #53260
char-syntax differs in interpreter and bytecode

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Fri, 14 Jan 2022 16:44:02 UTC

Severity: normal

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#53260: closed (char-syntax differs in interpreter and bytecode)
Date: Thu, 20 Jan 2022 10:48:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 20 Jan 2022 11:47:01 +0100
with message-id <748AD547-562F-495C-9BEC-D406953CFE4D <at> acm.org>
and subject line Re: bug#53260: char-syntax differs in interpreter and bytecode [PATCH]
has caused the debbugs.gnu.org bug report #53260,
regarding char-syntax differs in interpreter and bytecode
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
53260: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=53260
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: char-syntax differs in interpreter and bytecode
Date: Fri, 14 Jan 2022 17:43:00 +0100
Fchar_syntax and the bytecode Bchar_syntax differ:

Fchar_syntax calls SETUP_BUFFER_SYNTAX_TABLE. Bchar_syntax does not.
Bchar_syntax converts arguments to multibyte. Fchar_syntax does not.

The last property can be used to get different behaviour:

(let ((cs (byte-compile (lambda (x) (char-syntax x)))))
  (with-temp-buffer
    (let ((st (make-syntax-table)))
      (set-buffer-multibyte nil)
      (modify-syntax-entry 128 "_" st)
      (set-syntax-table st)
      (list (funcall cs 128) (char-syntax 128)))))
-> (119 95)

Not sure how to expose the presence or absence of SETUP_BUFFER_SYNTAX_TABLE. Suggestions?

And, most importantly, what would be the correct code?

(I suppose char-syntax is rare enough that we could call Fchar_syntax from Bchar_syntax and thus avoid any future divergence.)



[Message part 3 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 53260-done <at> debbugs.gnu.org
Subject: Re: bug#53260: char-syntax differs in interpreter and bytecode [PATCH]
Date: Thu, 20 Jan 2022 11:47:01 +0100
20 jan. 2022 kl. 10.30 skrev Lars Ingebrigtsen <larsi <at> gnus.org>:

> Makes sense to me.  Unless Stefan has any further comments, please go
> ahead and push.

Thank you, pushed with a necessary modification: SETUP_BUFFER_SYNTAX_TABLE() is indeed necessary in Fchar_syntax because syntax.c has its own local #define SYNTAX() and doesn't use the one in syntax.h. Lovely.



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

Previous Next


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