+/* Lisp functions for creating and removing buffer-local variables. */
+
+DEFUN ("make-variable-frame-local", Fmake_variable_frame_local, Smake_variable_frame_local,
+ 1, 1, "vMake Variable Frame Local: ",
+ doc: /* Enable VARIABLE to have frame-local bindings.
+When a frame-local binding exists in the current frame,
+it is in effect whenever the current buffer has no buffer-local binding.
+A frame-local binding is actual a frame parameter value;
+thus, any given frame has a local binding for VARIABLE
+if it has a value for the frame parameter named VARIABLE.
+See `modify-frame-parameters'. */)
+ (variable)
+ register Lisp_Object variable;
+{
+ register Lisp_Object tem, valcontents, newval;
+
+ CHECK_SYMBOL (variable);
+
+ valcontents = SYMBOL_VALUE (variable);
+ if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)
+ || BUFFER_OBJFWDP (valcontents))
+ error ("Symbol %s may not be frame-local", XSYMBOL (variable)->name->data);
+
+ if (BUFFER_LOCAL_VALUEP (valcontents)
+ || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ {
+ XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1;
+ return variable;
+ }
+
+ if (EQ (valcontents, Qunbound))
+ SET_SYMBOL_VALUE (variable, Qnil);
+ tem = Fcons (Qnil, Fsymbol_value (variable));
+ XSETCAR (tem, tem);
+ newval = allocate_misc ();
+ XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value;
+ XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
+ XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
+ XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
+ XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
+ XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
+ XBUFFER_LOCAL_VALUE (newval)->check_frame = 1;
+ XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
+ SET_SYMBOL_VALUE (variable, newval);
+ return variable;
+}
+