# HG changeset patch # User Gerd Moellmann # Date 960902519 0 # Node ID e38bc8c4c7b3d4336c0f3aab328b5de8a6fd3e37 # Parent 14aa31254532ad08905bec717f60eeccbb7eac8b (swap_in_global_binding): New function. diff -r 14aa31254532 -r e38bc8c4c7b3 src/data.c --- a/src/data.c Tue Jun 13 13:21:40 2000 +0000 +++ b/src/data.c Tue Jun 13 13:21:59 2000 +0000 @@ -840,6 +840,36 @@ } } +/* Set up SYMBOL to refer to its global binding. + This makes it safe to alter the status of other bindings. */ + +void +swap_in_global_binding (symbol) + Lisp_Object symbol; +{ + Lisp_Object valcontents, cdr; + + valcontents = XSYMBOL (symbol)->value; + if (!BUFFER_LOCAL_VALUEP (valcontents) + && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) + abort (); + cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; + + /* Unload the previously loaded binding. */ + Fsetcdr (XCAR (cdr), + do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); + + /* Select the global binding in the symbol. */ + XCAR (cdr) = cdr; + store_symval_forwarding (symbol, valcontents, XCDR (cdr)); + + /* Indicate that the global binding is set up now. */ + XBUFFER_LOCAL_VALUE (valcontents)->frame = Qnil; + XBUFFER_LOCAL_VALUE (valcontents)->buffer = Qnil; + XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; + XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; +} + /* Set up the buffer-local symbol SYMBOL for validity in the current buffer. VALCONTENTS is the contents of its value cell, which points to a struct Lisp_Buffer_Local_Value. @@ -1003,6 +1033,9 @@ if (NILP (buf->name)) return newval; + if (strcmp (XSYMBOL (symbol)->name->data, "foo") == 0) + fprintf (stderr, "foo\n"); + CHECK_SYMBOL (symbol, 0); if (NILP (symbol) || EQ (symbol, Qt) || (XSYMBOL (symbol)->name->data[0] == ':'