Subject: bug#69049: 29.2; Buglet in `read-from-string' (and, likely, `read') with defstructs.

From: Eli Zaretskii <[email-masked]>
Date: Sun, 11 Feb 2024 15:26:50 +0200

> Cc: [email-masked]
> From: Philip Kaludercic <[email-masked]>
> Date: Sun, 11 Feb 2024 12:37:08 +0000
> 
> Marco Antoniotti <[email-masked]> writes:
> 
> > Hi
> >
> > Here is the problem.  This is in IELM.
> >
> > ELISP> (cl-defstruct foo (msg "bar"))
> > foo
> > ELISP> (make-foo)
> > #s(foo :msg "bar")
> >
> > ELISP> (make-foo :msg "baz")
> > #s(foo :msg "baz")
> >
> > ELISP> (read-from-string "#s(foo :msg \"baz\")")
> > (#s(foo :msg :msg)
> >    . 18)
> 
> FWIW on Emacs 30.0.50 I get
> 
> (read-from-string "#s(foo :msg \"baz\")") ;=> (#s(foo :msg "baz") . 18)

The doc string of read-from-string says:

  read-from-string is a built-in function in ‘src/lread.c’.

  (read-from-string STRING &optional START END)

  Read one Lisp expression which is represented as text by STRING.
  Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
  FINAL-STRING-INDEX is an integer giving the position of the next
  remaining character in STRING.

So it looks like read-from-string is working as advertised here?