diff options
| author | Gerd Moellmann | 2000-06-13 13:21:59 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-06-13 13:21:59 +0000 |
| commit | b0d53addf7f02e815af2809e5d0fa21c3c68806b (patch) | |
| tree | be5f49c2ede0303d1d9c5c86eec4544c6af07cb7 /src/data.c | |
| parent | 64362cd4c7652fb751684f85e72b0129ca57fd58 (diff) | |
| download | emacs-b0d53addf7f02e815af2809e5d0fa21c3c68806b.tar.gz emacs-b0d53addf7f02e815af2809e5d0fa21c3c68806b.zip | |
(swap_in_global_binding): New function.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c index f43d15f8e96..d083f5f84f5 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -840,6 +840,36 @@ store_symval_forwarding (symbol, valcontents, newval) | |||
| 840 | } | 840 | } |
| 841 | } | 841 | } |
| 842 | 842 | ||
| 843 | /* Set up SYMBOL to refer to its global binding. | ||
| 844 | This makes it safe to alter the status of other bindings. */ | ||
| 845 | |||
| 846 | void | ||
| 847 | swap_in_global_binding (symbol) | ||
| 848 | Lisp_Object symbol; | ||
| 849 | { | ||
| 850 | Lisp_Object valcontents, cdr; | ||
| 851 | |||
| 852 | valcontents = XSYMBOL (symbol)->value; | ||
| 853 | if (!BUFFER_LOCAL_VALUEP (valcontents) | ||
| 854 | && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) | ||
| 855 | abort (); | ||
| 856 | cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; | ||
| 857 | |||
| 858 | /* Unload the previously loaded binding. */ | ||
| 859 | Fsetcdr (XCAR (cdr), | ||
| 860 | do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); | ||
| 861 | |||
| 862 | /* Select the global binding in the symbol. */ | ||
| 863 | XCAR (cdr) = cdr; | ||
| 864 | store_symval_forwarding (symbol, valcontents, XCDR (cdr)); | ||
| 865 | |||
| 866 | /* Indicate that the global binding is set up now. */ | ||
| 867 | XBUFFER_LOCAL_VALUE (valcontents)->frame = Qnil; | ||
| 868 | XBUFFER_LOCAL_VALUE (valcontents)->buffer = Qnil; | ||
| 869 | XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; | ||
| 870 | XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; | ||
| 871 | } | ||
| 872 | |||
| 843 | /* Set up the buffer-local symbol SYMBOL for validity in the current buffer. | 873 | /* Set up the buffer-local symbol SYMBOL for validity in the current buffer. |
| 844 | VALCONTENTS is the contents of its value cell, | 874 | VALCONTENTS is the contents of its value cell, |
| 845 | which points to a struct Lisp_Buffer_Local_Value. | 875 | which points to a struct Lisp_Buffer_Local_Value. |
| @@ -1003,6 +1033,9 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 1003 | if (NILP (buf->name)) | 1033 | if (NILP (buf->name)) |
| 1004 | return newval; | 1034 | return newval; |
| 1005 | 1035 | ||
| 1036 | if (strcmp (XSYMBOL (symbol)->name->data, "foo") == 0) | ||
| 1037 | fprintf (stderr, "foo\n"); | ||
| 1038 | |||
| 1006 | CHECK_SYMBOL (symbol, 0); | 1039 | CHECK_SYMBOL (symbol, 0); |
| 1007 | if (NILP (symbol) || EQ (symbol, Qt) | 1040 | if (NILP (symbol) || EQ (symbol, Qt) |
| 1008 | || (XSYMBOL (symbol)->name->data[0] == ':' | 1041 | || (XSYMBOL (symbol)->name->data[0] == ':' |