Subject: Re: bug#6490: 24.0.50; src/lread.c: old style backquote bug?

From: Tetsurou Okazaki <[email-masked]>
Date: Thu, 01 Jul 2010 14:41:49 +0900

At Wed, 23 Jun 2010 00:23:15 +0200,
Stefan Monnier wrote:
> 
> > Attached patch for Emacs fixes this error.
> 
> I'm glad the patch fixes things for you, since this patch indeed looks
> perfectly harmless, but I'm a bit puzzled because it doesn't just look
> harmless: it looks to me like the patch does change anything to the way
> the code works.  So could you explain to me how&why the patch fixes
> the problem?  I'm probably just overlooking some "obvious" detail,

The changes committed in rev:100605 reassigns the next character to the variable `c'.
When the next character is SPC (32, #o40, #x20), old style backquote is detected.

  if (first_in_list && (c = READCHAR, UNREAD (c), c == ' '))
    {
      Vold_style_backquotes = Qt;
      goto default_label;
    }

But backquote handling is skipped because `c' is SPC.

    default_label:
      if (c <= 040) goto retry;

      ... old style backquote handling ...

My patch avoids reassignment of `c' not to skip old style backquote handling.

To keep more compatibility with released Emacs, it is preferable to
allow a character such as \r or \n after the old style backquote.

=== modified file 'src/lread.c'
--- src/lread.c	2010-06-16 14:10:02 +0000
+++ src/lread.c	2010-06-27 11:48:20 +0000
@@ -2693,21 +2693,26 @@
 	 old-style.  For Emacs-25, we should completely remove this
 	 first_in_list exception (old-style can still be obtained via
 	 "(\`" anyway).  */
-      if (first_in_list && (c = READCHAR, UNREAD (c), c == ' '))
-	{
-	  Vold_style_backquotes = Qt;
-	  goto default_label;
-	}
-      else
-	{
-	  Lisp_Object value;
-
-	  new_backquote_flag++;
-	  value = read0 (readcharfun);
-	  new_backquote_flag--;
-
-	  return Fcons (Qbackquote, Fcons (value, Qnil));
-	}
+      {
+        int ch = READCHAR;
+        UNREAD (ch);
+
+	if (first_in_list && (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '\f'))
+	  {
+	    Vold_style_backquotes = Qt;
+	    goto default_label;
+	  }
+	else
+	  {
+	    Lisp_Object value;
+
+	    new_backquote_flag++;
+	    value = read0 (readcharfun);
+	    new_backquote_flag--;
+
+	    return Fcons (Qbackquote, Fcons (value, Qnil));
+	  }
+      }
 
     case ',':
       if (new_backquote_flag)