Lisp_Object ret = assq_no_quit (get_current_thread (), l->thread_data);
if (NILP (ret))
{
- Lisp_Object len, tem, parent = XCDR (XCAR (l->thread_data));
+ Lisp_Object len, parent = XCDR (XCAR (l->thread_data));
XSETFASTINT (len, 4);
ret = Fmake_vector (len, Qnil);
/* FIXME: use the parent, not the first element. (or not?) */
XSETFASTINT (AREF (ret, 0), AREF (parent, 0));
- BLOCAL_BUFFER_VEC (ret) = BLOCAL_BUFFER_VEC (parent);
- BLOCAL_FRAME_VEC (ret) = BLOCAL_FRAME_VEC (parent);
- tem = Fcons (Qnil, Qnil);
- XSETCAR (tem, tem);
- BLOCAL_CDR_VEC (ret) = tem;
+ BLOCAL_BUFFER_VEC (ret) = BLOCAL_BUFFER_VEC (ret);
+ BLOCAL_FRAME_VEC (ret) = BLOCAL_FRAME_VEC (ret);
+ BLOCAL_CDR_VEC (ret) = BLOCAL_CDR_VEC (parent);
ret = Fcons (get_current_thread (), ret);
l->thread_data = Fcons (ret, l->thread_data);
XTHREADLOCAL (l->realvalue)->thread_alist =
- Fcons (Fcons (get_current_thread (), Qunbound),
+ Fcons (Fcons (get_current_thread (),
+ XCDR (XCAR (XTHREADLOCAL (l->realvalue)->thread_alist))),
XTHREADLOCAL (l->realvalue)->thread_alist);
}
def:
valcontents = SYMBOL_VALUE (symbol);
if (BUFFER_LOCAL_VALUEP (valcontents))
- BLOCAL_REALVALUE (XBUFFER_LOCAL_VALUE (valcontents)) = newval;
+ {
+ Lisp_Object v = BLOCAL_CDR (XBUFFER_LOCAL_VALUE (valcontents));
+ if (EQ (v, XCAR (v)))
+ BLOCAL_REALVALUE (XBUFFER_LOCAL_VALUE (valcontents)) = newval;
+ else
+ {
+ Lisp_Object rv = XBUFFER_LOCAL_VALUE (valcontents)->realvalue;
+ XTHREADLOCAL (rv)->global = newval;
+ }
+ }
else if (THREADLOCALP (valcontents))
{
Lisp_Object val = indirect_variable (XSYMBOL (symbol))->value;
Fcdr (tem1), NULL);
}
- return BLOCAL_REALVALUE (XBUFFER_LOCAL_VALUE (valcontents));
+ {
+ Lisp_Object v = BLOCAL_CDR (XBUFFER_LOCAL_VALUE (valcontents));
+ if (EQ (v, XCAR (v)))
+ return BLOCAL_REALVALUE (XBUFFER_LOCAL_VALUE (valcontents));
+ else
+ return XTHREADLOCAL (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)->global;
+ }
}
\f
XBUFFER_LOCAL_VALUE (newval)->realvalue = allocate_misc ();
XMISCTYPE (XBUFFER_LOCAL_VALUE (newval)->realvalue)
= Lisp_Misc_ThreadLocal;
- XTHREADLOCAL (XBUFFER_LOCAL_VALUE (newval)->realvalue)->global = Qnil;
+ XTHREADLOCAL (XBUFFER_LOCAL_VALUE (newval)->realvalue)->global
+ = Fsymbol_value (variable);
XTHREADLOCAL (XBUFFER_LOCAL_VALUE (newval)->realvalue)->thread_alist
= Fcons (Fcons (get_current_thread (), Qnil), Qnil);
BLOCAL_REALVALUE (XBUFFER_LOCAL_VALUE (newval)) = sym->value;