From 02f28bbdceb3cad843308d9ad0386ff5c492db9c Mon Sep 17 00:00:00 2001
From: "Richard M. Stallman" <rms@gnu.org>
Date: Sat, 22 May 2004 22:20:51 +0000
Subject: [PATCH] (clone_per_buffer_values): Copy the alist of local vars, and
 the alist pairs too.

---
 src/buffer.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/buffer.c b/src/buffer.c
index 7560e696685..532a768ba50 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -487,7 +487,7 @@ static void
 clone_per_buffer_values (from, to)
      struct buffer *from, *to;
 {
-  Lisp_Object to_buffer;
+  Lisp_Object to_buffer, tem;
   int offset;
 
   XSETBUFFER (to_buffer, to);
@@ -514,6 +514,14 @@ clone_per_buffer_values (from, to)
 
   to->overlays_before = copy_overlays (to, from->overlays_before);
   to->overlays_after = copy_overlays (to, from->overlays_after);
+
+  /* Copy the alist of local variables,
+     and all the alist elements too.  */
+  to->local_var_alist
+    = Fcopy_sequence (from->local_var_alist);
+  for (tem = to->local_var_alist; CONSP (tem);
+       tem = XCDR (tem))
+    XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem))));
 }
 
 
-- 
2.39.5