changeset 1278:0a0646ae381f

* data.c (Fmake_local_variable): If SYM forwards to a C variable, swap in the value for the current buffer immediately.
author Jim Blandy <jimb@redhat.com>
date Wed, 30 Sep 1992 11:35:45 +0000
parents 61f4bd399f61
children 74ae34a80f94
files src/data.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Wed Sep 30 11:29:49 1992 +0000
+++ b/src/data.c	Wed Sep 30 11:35:45 1992 +0000
@@ -1007,6 +1007,8 @@
   return val;
 }
 
+/* Lisp functions for creating and removing buffer-local variables.  */
+
 DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local,
   1, 1, "vMake Variable Buffer Local: ",
   "Make VARIABLE have a separate value for each buffer.\n\
@@ -1101,8 +1103,18 @@
 	if (current_buffer == XBUFFER (XCONS (XCONS (xs)->cdr)->car))
 	  XCONS (XCONS (XSYMBOL (sym)->value)->cdr)->car = Qnil; 
       }
+    }
 
-    }
+  /* If the symbol forwards into a C variable, then swap in the
+     variable for this buffer immediately.  If C code modifies the
+     variable before we swap in, then that new value will clobber the
+     default value the next time we swap.  */
+  valcontents = XCONS (XSYMBOL (sym)->value)->car;
+  if (XTYPE (valcontents) == Lisp_Intfwd
+      || XTYPE (valcontents) == Lisp_Boolfwd
+      || XTYPE (valcontents) == Lisp_Objfwd)
+    swap_in_symval_forwarding (sym, XSYMBOL (sym)->value);
+
   return sym;
 }