unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "richard newton" <richardn26@gmail.com>,
	"Mattias Engdegård" <mattiase@acm.org>
Cc: 63722@debbugs.gnu.org
Subject: bug#63722: 29.0.91; (elisp) Skip to end #@00 does not work
Date: Thu, 25 May 2023 21:44:28 +0300	[thread overview]
Message-ID: <83y1lcl08j.fsf@gnu.org> (raw)
In-Reply-To: <CAP=hJOEhxRpMKQqZSfCoTG-F5EfBcw-ymP2ga+H7Wo4TY6hd1Q@mail.gmail.com> (message from richard newton on Thu, 25 May 2023 16:19:42 +0200)

> From: richard newton <richardn26@gmail.com>
> Date: Thu, 25 May 2023 16:19:42 +0200
> 
> With emacs 29.0.91 pretest, the "skip to end" syntax #@00 no longer seems to work. For example,
> with the three lines below in a buffer (eval-buffer) gives the error - End of file during parsing. With
> previous emacs versions it did not complain.
> 
> (setq testStr "zz")
> #@00
> should be ignored

Thanks.

Mattias, this is due to commit b903507b36, which fixed bug#55676.  It
introduced a subtle change in the behavior of read0 in this case.

Does the below look like the correct way of fixing this regression?

diff --git a/src/lread.c b/src/lread.c
index 342d367..6ee2829 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3400,8 +3400,9 @@ read_bool_vector (Lisp_Object readcharfun)
 }
 
 /* Skip (and optionally remember) a lazily-loaded string
-   preceded by "#@".  */
-static void
+   preceded by "#@".  Return non-zero if we skip to EOB,
+   otherwise zero.  */
+static bool
 skip_lazy_string (Lisp_Object readcharfun)
 {
   ptrdiff_t nskip = 0;
@@ -3429,7 +3430,7 @@ skip_lazy_string (Lisp_Object readcharfun)
 	{
 	  /* #@00 means "skip to end" */
 	  skip_dyn_eof (readcharfun);
-	  return;
+	  return true;
 	}
     }
 
@@ -3476,6 +3477,8 @@ skip_lazy_string (Lisp_Object readcharfun)
   else
     /* Skip that many bytes.  */
     skip_dyn_bytes (readcharfun, nskip);
+
+  return false;
 }
 
 /* Given a lazy-loaded string designator VAL, return the actual string.
@@ -3933,7 +3936,8 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
 	    /* #@NUMBER is used to skip NUMBER following bytes.
 	       That's used in .elc files to skip over doc strings
 	       and function definitions that can be loaded lazily.  */
-	    skip_lazy_string (readcharfun);
+	    if (skip_lazy_string (readcharfun))
+	      return unbind_to (base_pdl, Qnil);
 	    goto read_obj;
 
 	  case '$':





  reply	other threads:[~2023-05-25 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 14:19 bug#63722: 29.0.91; (elisp) Skip to end #@00 does not work richard newton
2023-05-25 18:44 ` Eli Zaretskii [this message]
2023-05-26  9:22   ` Mattias Engdegård
2023-05-26  9:43     ` Michael Albinus
2023-05-26  9:51       ` Mattias Engdegård
2023-05-26  9:56         ` Michael Albinus
2023-05-26 10:36           ` Eli Zaretskii
2023-05-26 11:55             ` 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=83y1lcl08j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63722@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    --cc=richardn26@gmail.com \
    /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).