From 721b7d9ee61e436d012527664fee8acc152f4715 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 28 Dec 2005 03:44:28 +0000 Subject: [PATCH] (readevalloop): Set PT and ZV in the proper buffer, not the current one. --- src/lread.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lread.c b/src/lread.c index 5fb0a39ff03..c8aa55780c2 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1344,10 +1344,20 @@ readevalloop (readcharfun, stream, sourcename, evalfun, if (b != 0 && NILP (b->name)) error ("Reading from killed buffer"); + if (!NILP (start)) { + /* Switch to the buffer we are reading from. */ + record_unwind_protect (save_excursion_restore, save_excursion_save ()); + set_buffer_internal (b); + + /* Save point in it. */ record_unwind_protect (save_excursion_restore, save_excursion_save ()); + /* Save ZV in it. */ record_unwind_protect (save_restriction_restore, save_restriction_save ()); + /* Those get unbound after we read one expression. */ + + /* Set point and ZV around stuff to be read. */ Fgoto_char (start); Fnarrow_to_region (make_number (BEGV), end); } -- 2.11.4.GIT