Subject: Re: bug#24542: 25.1.50; The symbol `@' and sexp scanning

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 04 Sep 2020 15:05:36 +0200

Michael Heerdegen <[email-masked]> writes:

> Thanks for the patch.  Can anyone judge whether we can do this?

I tried the patch, and it fixes the

(setq a '@)

problem for me.  I don't really have a great overview of where
scan_lists is used for -- it seems like a very general solution to a
very specific problem.

Does anybody have any comments here?

diff --git a/src/syntax.c b/src/syntax.c
index 7f0fc341f6..10912dd5f2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2693,7 +2693,17 @@ scan_lists (EMACS_INT from0, EMACS_INT count, EMACS_INT depth, bool sexpflag)
 	    }
 
 	  if (prefix)
-	    continue;
+            {
+              int next_c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+              int next_syntax = SYNTAX_WITH_FLAGS (next_c);
+              bool next_prefix = SYNTAX_FLAGS_PREFIX (next_syntax);
+              enum syntaxcode next_code =
+		syntax_multibyte (next_c, multibyte_symbol_p);
+              if (next_prefix
+                  || next_code == Ssymbol
+                  || next_code == Sword)
+                continue;
+            }
 
 	  switch (code)
 	    {

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