Subject: Re: bug#9960: Compiling Emacs trunk with MSVC

From: Eli Zaretskii <[email-masked]>
Date: Sat, 12 Nov 2011 16:27:59 +0200

> From: Fabrice Popineau <[email-masked]>
> Date: Fri, 11 Nov 2011 20:28:21 +0100
> Cc: [email-masked], [email-masked]
> 
> > +++ lisp/bindings.el  2011-11-10 17:49:35 +0000
> > > @@ -824,13 +824,13 @@
> > >  ;; Define control-digits.
> > >  (let ((i ?0))
> > >    (while (<= i ?9)
> > > -    (define-key global-map (read (format "[?\\C-%c]" i))
> > 'digit-argument)
> > > +;    (define-key global-map (read (format "[?\\C-%c]" i))
> > 'digit-argument)
> > >      (setq i (1+ i))))
> > >  (define-key global-map [?\C--] 'negative-argument)
> > >  ;; Define control-meta-digits.
> > >  (let ((i ?0))
> > >    (while (<= i ?9)
> > > -    (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
> > > +;    (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
> > >      (setq i (1+ i))))
> > >  (define-key global-map [?\C-\M--] 'negative-argument)
> >
> > Why is this part needed?
> >
> 
> I would like to know. I get an error when bootstrapping at these lines :
> invalid read syntax.
> If someone has a suggestion on how to investigate it, I'd like to hear it:
> 
> Loading bindings (source)...
> Invalid read syntax: "?"
> NMAKE : fatal error U1077:
> 'C:\Source\XEmTeX\mirror\emacs\src/obj-spd/i386/temacs.exe' : return code
> '0xffffffff'
> Stop.
> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio
> 10.0\VC\Bin\nmake.exe"' : return code '0x2'
> Stop.

This error comes from the following fragment in lread.c:read1

    case '?':
      {
	int modifiers;
	int next_char;
	int ok;

	c = READCHAR;
	if (c < 0)
	  end_of_file_error ();

	/* Accept `single space' syntax like (list ? x) where the
	   whitespace character is SPC or TAB.
	   Other literal whitespace like NL, CR, and FF are not accepted,
	   as there are well-established escape sequences for these.  */
	if (c == ' ' || c == '\t')
	  return make_number (c);

	if (c == '\\')
	  c = read_escape (readcharfun, 0);
	modifiers = c & CHAR_MODIFIER_MASK;
	c &= ~CHAR_MODIFIER_MASK;
	if (CHAR_BYTE8_P (c))
	  c = CHAR_TO_BYTE8 (c);
	c |= modifiers;

	next_char = READCHAR;
	ok = (next_char <= 040
	      || (next_char < 0200
		  && strchr ("\"';()[]#?`,.", next_char) != NULL));
	UNREAD (next_char);
	if (ok)
	  return make_number (c);

	invalid_syntax ("?");  <<<<<<<<<<<<<<<<<<
      }

Can you step through this in a debugger and see what character is seen
in next_char at the end of this snippet, and what value is in `c' at
that point, when it fails?  The function read_escape called by this
fragment could also be of interest.