unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 53260@debbugs.gnu.org
Subject: bug#53260: char-syntax differs in interpreter and bytecode
Date: Fri, 14 Jan 2022 17:43:00 +0100	[thread overview]
Message-ID: <0A87E4BA-4741-4688-A005-912ABFC86B83@acm.org> (raw)

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.)






             reply	other threads:[~2022-01-14 16:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 16:43 Mattias Engdegård [this message]
2022-01-15  8:36 ` bug#53260: char-syntax differs in interpreter and bytecode Lars Ingebrigtsen
2022-01-15 14:46   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 17:29     ` Mattias Engdegård
2022-01-15 17:57       ` Eli Zaretskii
2022-01-15 22:51       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-16 11:04         ` bug#53260: char-syntax differs in interpreter and bytecode [PATCH] Mattias Engdegård
2022-01-20  9:30           ` Lars Ingebrigtsen
2022-01-20 10:47             ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0A87E4BA-4741-4688-A005-912ABFC86B83@acm.org \
    --to=mattiase@acm.org \
    --cc=53260@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).