]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/lread.c (build_load_history): Be careful with in-place updates
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 4 Feb 2024 17:58:56 +0000 (12:58 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 7 Feb 2024 10:50:48 +0000 (11:50 +0100)
Don't leave a "broken" value in `Vcurrent_load_list`.

(cherry picked from commit 52abeaf1333427f156a23f0acf057e81bcc5e9e2)

src/lread.c

index cc55b009ab9f7688766e839d491761e4213b13ce..b1b109315f9a87dcce352b8c9fe691d10bb978fd 100644 (file)
@@ -2369,8 +2369,14 @@ build_load_history (Lisp_Object filename, bool entire)
      front of load-history, the most-recently-loaded position.  Also
      do this if we didn't find an existing member for the file.  */
   if (entire || !foundit)
-    Vload_history = Fcons (Fnreverse (Vcurrent_load_list),
-                          Vload_history);
+    {
+      Lisp_Object tem = Fnreverse (Vcurrent_load_list);
+      eassert (EQ (filename, Fcar (tem)));
+      Vload_history = Fcons (tem, Vload_history);
+      /* FIXME: There should be an unbind_to right after calling us which
+         should re-establish the previous value of Vcurrent_load_list.  */
+      Vcurrent_load_list = Qt;
+    }
 }
 
 static void