diff options
| author | Gerd Moellmann | 2000-03-26 14:05:44 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-03-26 14:05:44 +0000 |
| commit | 999b32fd113e6ce7570c5bff2712c2b628318f22 (patch) | |
| tree | 00e18bdb4a8bf3d3433ea733148a78ec7aa0c739 /src | |
| parent | 8170b12578db0f2d09994e2cd7e3651149b4648f (diff) | |
| download | emacs-999b32fd113e6ce7570c5bff2712c2b628318f22.tar.gz emacs-999b32fd113e6ce7570c5bff2712c2b628318f22.zip | |
(do_symval_forwarding, store_symval_forwarding)
(find_symbol_value, set_internal, default_value, Fset_default)
(Fkill_local_variable, Flocal_variable_p): Use new macros for
per-buffer variables.
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/src/data.c b/src/data.c index 4de8b257a75..16ce6a3c32e 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -738,7 +738,7 @@ do_symval_forwarding (valcontents) | |||
| 738 | 738 | ||
| 739 | case Lisp_Misc_Buffer_Objfwd: | 739 | case Lisp_Misc_Buffer_Objfwd: |
| 740 | offset = XBUFFER_OBJFWD (valcontents)->offset; | 740 | offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 741 | return *(Lisp_Object *)(offset + (char *)current_buffer); | 741 | return BUFFER_LOCAL_VALUE (current_buffer, offset); |
| 742 | 742 | ||
| 743 | case Lisp_Misc_Kboard_Objfwd: | 743 | case Lisp_Misc_Kboard_Objfwd: |
| 744 | offset = XKBOARD_OBJFWD (valcontents)->offset; | 744 | offset = XKBOARD_OBJFWD (valcontents)->offset; |
| @@ -783,7 +783,7 @@ store_symval_forwarding (symbol, valcontents, newval) | |||
| 783 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 783 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 784 | Lisp_Object type; | 784 | Lisp_Object type; |
| 785 | 785 | ||
| 786 | type = *(Lisp_Object *)(offset + (char *)&buffer_local_types); | 786 | type = BUFFER_LOCAL_TYPE (offset); |
| 787 | if (XINT (type) == -1) | 787 | if (XINT (type) == -1) |
| 788 | error ("Variable %s is read-only", XSYMBOL (symbol)->name->data); | 788 | error ("Variable %s is read-only", XSYMBOL (symbol)->name->data); |
| 789 | 789 | ||
| @@ -791,7 +791,7 @@ store_symval_forwarding (symbol, valcontents, newval) | |||
| 791 | && XTYPE (newval) != XINT (type)) | 791 | && XTYPE (newval) != XINT (type)) |
| 792 | buffer_slot_type_mismatch (offset); | 792 | buffer_slot_type_mismatch (offset); |
| 793 | 793 | ||
| 794 | *(Lisp_Object *)(offset + (char *)current_buffer) = newval; | 794 | BUFFER_LOCAL_VALUE (current_buffer, offset) = newval; |
| 795 | } | 795 | } |
| 796 | break; | 796 | break; |
| 797 | 797 | ||
| @@ -902,8 +902,8 @@ find_symbol_value (symbol) | |||
| 902 | return *XOBJFWD (valcontents)->objvar; | 902 | return *XOBJFWD (valcontents)->objvar; |
| 903 | 903 | ||
| 904 | case Lisp_Misc_Buffer_Objfwd: | 904 | case Lisp_Misc_Buffer_Objfwd: |
| 905 | return *(Lisp_Object *)(XBUFFER_OBJFWD (valcontents)->offset | 905 | return BUFFER_LOCAL_VALUE (current_buffer, |
| 906 | + (char *)current_buffer); | 906 | XBUFFER_OBJFWD (valcontents)->offset); |
| 907 | 907 | ||
| 908 | case Lisp_Misc_Kboard_Objfwd: | 908 | case Lisp_Misc_Kboard_Objfwd: |
| 909 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset | 909 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset |
| @@ -990,12 +990,12 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 990 | 990 | ||
| 991 | if (BUFFER_OBJFWDP (valcontents)) | 991 | if (BUFFER_OBJFWDP (valcontents)) |
| 992 | { | 992 | { |
| 993 | register int idx = XBUFFER_OBJFWD (valcontents)->offset; | 993 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 994 | register int mask = XINT (*((Lisp_Object *) | 994 | int idx = BUFFER_LOCAL_IDX (offset); |
| 995 | (idx + (char *)&buffer_local_flags))); | 995 | if (idx > 0 |
| 996 | if (mask > 0 && ! bindflag | 996 | && !bindflag |
| 997 | && ! let_shadows_buffer_binding_p (symbol)) | 997 | && !let_shadows_buffer_binding_p (symbol)) |
| 998 | buf->local_var_flags |= mask; | 998 | SET_BUFFER_HAS_LOCAL_VALUE_P (buf, idx, 1); |
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| 1001 | else if (BUFFER_LOCAL_VALUEP (valcontents) | 1001 | else if (BUFFER_LOCAL_VALUEP (valcontents) |
| @@ -1107,10 +1107,9 @@ default_value (symbol) | |||
| 1107 | rather than letting do_symval_forwarding get the current value. */ | 1107 | rather than letting do_symval_forwarding get the current value. */ |
| 1108 | if (BUFFER_OBJFWDP (valcontents)) | 1108 | if (BUFFER_OBJFWDP (valcontents)) |
| 1109 | { | 1109 | { |
| 1110 | register int idx = XBUFFER_OBJFWD (valcontents)->offset; | 1110 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1111 | 1111 | if (BUFFER_LOCAL_IDX (offset) != 0) | |
| 1112 | if (XINT (*(Lisp_Object *) (idx + (char *) &buffer_local_flags)) != 0) | 1112 | return BUFFER_LOCAL_DEFAULT_VALUE (offset); |
| 1113 | return *(Lisp_Object *)(idx + (char *) &buffer_defaults); | ||
| 1114 | } | 1113 | } |
| 1115 | 1114 | ||
| 1116 | /* Handle user-created local variables. */ | 1115 | /* Handle user-created local variables. */ |
| @@ -1180,20 +1179,20 @@ for this variable.") | |||
| 1180 | variables. */ | 1179 | variables. */ |
| 1181 | if (BUFFER_OBJFWDP (valcontents)) | 1180 | if (BUFFER_OBJFWDP (valcontents)) |
| 1182 | { | 1181 | { |
| 1183 | register int idx = XBUFFER_OBJFWD (valcontents)->offset; | 1182 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1184 | register struct buffer *b; | 1183 | int idx = BUFFER_LOCAL_IDX (offset); |
| 1185 | register int mask = XINT (*((Lisp_Object *) | ||
| 1186 | (idx + (char *)&buffer_local_flags))); | ||
| 1187 | 1184 | ||
| 1188 | *(Lisp_Object *)(idx + (char *) &buffer_defaults) = value; | 1185 | BUFFER_LOCAL_DEFAULT_VALUE (offset) = value; |
| 1189 | 1186 | ||
| 1190 | /* If this variable is not always local in all buffers, | 1187 | /* If this variable is not always local in all buffers, |
| 1191 | set it in the buffers that don't nominally have a local value. */ | 1188 | set it in the buffers that don't nominally have a local value. */ |
| 1192 | if (mask > 0) | 1189 | if (idx > 0) |
| 1193 | { | 1190 | { |
| 1191 | struct buffer *b; | ||
| 1192 | |||
| 1194 | for (b = all_buffers; b; b = b->next) | 1193 | for (b = all_buffers; b; b = b->next) |
| 1195 | if (!(b->local_var_flags & mask)) | 1194 | if (!BUFFER_HAS_LOCAL_VALUE_P (b, idx)) |
| 1196 | *(Lisp_Object *)(idx + (char *) b) = value; | 1195 | BUFFER_LOCAL_VALUE (b, offset) = value; |
| 1197 | } | 1196 | } |
| 1198 | return value; | 1197 | return value; |
| 1199 | } | 1198 | } |
| @@ -1410,15 +1409,14 @@ From now on the default value will apply in this buffer.") | |||
| 1410 | 1409 | ||
| 1411 | if (BUFFER_OBJFWDP (valcontents)) | 1410 | if (BUFFER_OBJFWDP (valcontents)) |
| 1412 | { | 1411 | { |
| 1413 | register int idx = XBUFFER_OBJFWD (valcontents)->offset; | 1412 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1414 | register int mask = XINT (*((Lisp_Object*) | 1413 | int idx = BUFFER_LOCAL_IDX (offset); |
| 1415 | (idx + (char *)&buffer_local_flags))); | ||
| 1416 | 1414 | ||
| 1417 | if (mask > 0) | 1415 | if (idx > 0) |
| 1418 | { | 1416 | { |
| 1419 | *(Lisp_Object *)(idx + (char *) current_buffer) | 1417 | SET_BUFFER_HAS_LOCAL_VALUE_P (current_buffer, idx, 0); |
| 1420 | = *(Lisp_Object *)(idx + (char *) &buffer_defaults); | 1418 | BUFFER_LOCAL_VALUE (current_buffer, offset) |
| 1421 | current_buffer->local_var_flags &= ~mask; | 1419 | = BUFFER_LOCAL_DEFAULT_VALUE (offset); |
| 1422 | } | 1420 | } |
| 1423 | return variable; | 1421 | return variable; |
| 1424 | } | 1422 | } |
| @@ -1534,8 +1532,8 @@ BUFFER defaults to the current buffer.") | |||
| 1534 | if (BUFFER_OBJFWDP (valcontents)) | 1532 | if (BUFFER_OBJFWDP (valcontents)) |
| 1535 | { | 1533 | { |
| 1536 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 1534 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 1537 | int mask = XINT (*(Lisp_Object *)(offset + (char *)&buffer_local_flags)); | 1535 | int idx = BUFFER_LOCAL_IDX (offset); |
| 1538 | if (mask == -1 || (buf->local_var_flags & mask)) | 1536 | if (idx == -1 || BUFFER_HAS_LOCAL_VALUE_P (buf, idx)) |
| 1539 | return Qt; | 1537 | return Qt; |
| 1540 | } | 1538 | } |
| 1541 | return Qnil; | 1539 | return Qnil; |