diff options
| author | Stefan Monnier | 2008-05-19 18:38:55 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-05-19 18:38:55 +0000 |
| commit | ad97b375e8189e1826d562898ea78e4f3bb94bda (patch) | |
| tree | 4b24a048a633d964e947b4263c1e89ec39958a9e /src | |
| parent | 61bd39a3bd199e2ad73dfa74105ff062dcf26580 (diff) | |
| download | emacs-ad97b375e8189e1826d562898ea78e4f3bb94bda.tar.gz emacs-ad97b375e8189e1826d562898ea78e4f3bb94bda.zip | |
* lisp.h (indirect_variable):
* data.c (indirect_variable, let_shadows_buffer_binding_p):
Use Lisp_Symbol pointers rather than Lisp_Object. Adjust callers.
* buffer.c (buffer_slot_type_mismatch): Use wrong-type-argument.
To this end, change calling-convention.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/buffer.c | 33 | ||||
| -rw-r--r-- | src/data.c | 130 | ||||
| -rw-r--r-- | src/lisp.h | 6 |
4 files changed, 101 insertions, 85 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 63a374b912a..0232ce4a1ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,13 +1,20 @@ | |||
| 1 | 2008-05-19 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * process.c (wait_reading_process_output): Always check status | ||
| 4 | when in batch mode. | ||
| 5 | |||
| 6 | 2008-05-19 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-05-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 7 | 2 | ||
| 3 | * lisp.h (indirect_variable): | ||
| 4 | * data.c (indirect_variable, let_shadows_buffer_binding_p): | ||
| 5 | Use Lisp_Symbol pointers rather than Lisp_Object. | ||
| 6 | Adjust callers. | ||
| 7 | * buffer.c (buffer_slot_type_mismatch): Use wrong-type-argument. | ||
| 8 | To this end, change calling-convention. | ||
| 9 | |||
| 8 | * minibuf.c (Finternal_complete_buffer): Only strip out hidden buffers | 10 | * minibuf.c (Finternal_complete_buffer): Only strip out hidden buffers |
| 9 | if some non-hidden buffers are selected by string&pred. | 11 | if some non-hidden buffers are selected by string&pred. |
| 10 | 12 | ||
| 13 | 2008-05-19 Chong Yidong <cyd@stupidchicken.com> | ||
| 14 | |||
| 15 | * process.c (wait_reading_process_output): Always check status | ||
| 16 | when in batch mode. | ||
| 17 | |||
| 11 | 2008-05-19 Kenichi Handa <handa@m17n.org> | 18 | 2008-05-19 Kenichi Handa <handa@m17n.org> |
| 12 | 19 | ||
| 13 | * font.c (font_list_entities): Fix handling of cache. | 20 | * font.c (font_list_entities): Fix handling of cache. |
diff --git a/src/buffer.c b/src/buffer.c index 5633b29f5f9..86ba8263ab1 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -927,12 +927,14 @@ is the default binding of the variable. */) | |||
| 927 | { | 927 | { |
| 928 | register struct buffer *buf; | 928 | register struct buffer *buf; |
| 929 | register Lisp_Object result; | 929 | register Lisp_Object result; |
| 930 | struct Lisp_Symbol *sym; | ||
| 930 | 931 | ||
| 931 | CHECK_SYMBOL (variable); | 932 | CHECK_SYMBOL (variable); |
| 932 | CHECK_BUFFER (buffer); | 933 | CHECK_BUFFER (buffer); |
| 933 | buf = XBUFFER (buffer); | 934 | buf = XBUFFER (buffer); |
| 934 | 935 | ||
| 935 | variable = indirect_variable (variable); | 936 | sym = indirect_variable (XSYMBOL (variable)); |
| 937 | XSETSYMBOL (variable, sym); | ||
| 936 | 938 | ||
| 937 | /* Look in local_var_list */ | 939 | /* Look in local_var_list */ |
| 938 | result = Fassoc (variable, buf->local_var_alist); | 940 | result = Fassoc (variable, buf->local_var_alist); |
| @@ -969,7 +971,7 @@ is the default binding of the variable. */) | |||
| 969 | Lisp_Object current_alist_element; | 971 | Lisp_Object current_alist_element; |
| 970 | 972 | ||
| 971 | /* What binding is loaded right now? */ | 973 | /* What binding is loaded right now? */ |
| 972 | valcontents = SYMBOL_VALUE (variable); | 974 | valcontents = sym->value; |
| 973 | current_alist_element | 975 | current_alist_element |
| 974 | = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | 976 | = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); |
| 975 | 977 | ||
| @@ -4550,32 +4552,21 @@ evaporate_overlays (pos) | |||
| 4550 | in the slot with offset OFFSET. */ | 4552 | in the slot with offset OFFSET. */ |
| 4551 | 4553 | ||
| 4552 | void | 4554 | void |
| 4553 | buffer_slot_type_mismatch (sym, type) | 4555 | buffer_slot_type_mismatch (newval, type) |
| 4554 | Lisp_Object sym; | 4556 | Lisp_Object newval; |
| 4555 | int type; | 4557 | int type; |
| 4556 | { | 4558 | { |
| 4557 | char *type_name; | 4559 | Lisp_Object predicate; |
| 4558 | 4560 | ||
| 4559 | switch (type) | 4561 | switch (type) |
| 4560 | { | 4562 | { |
| 4561 | case Lisp_Int: | 4563 | case Lisp_Int: predicate = Qintegerp; break; |
| 4562 | type_name = "integers"; | 4564 | case Lisp_String: predicate = Qstringp; break; |
| 4563 | break; | 4565 | case Lisp_Symbol: predicate = Qsymbolp; break; |
| 4564 | 4566 | default: abort (); | |
| 4565 | case Lisp_String: | ||
| 4566 | type_name = "strings"; | ||
| 4567 | break; | ||
| 4568 | |||
| 4569 | case Lisp_Symbol: | ||
| 4570 | type_name = "symbols"; | ||
| 4571 | break; | ||
| 4572 | |||
| 4573 | default: | ||
| 4574 | abort (); | ||
| 4575 | } | 4567 | } |
| 4576 | 4568 | ||
| 4577 | error ("Only %s should be stored in the buffer-local variable %s", | 4569 | wrong_type_argument (predicate, newval); |
| 4578 | type_name, SDATA (SYMBOL_NAME (sym))); | ||
| 4579 | } | 4570 | } |
| 4580 | 4571 | ||
| 4581 | 4572 | ||
diff --git a/src/data.c b/src/data.c index 0bca9da07d9..f86d5c7c61b 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -813,25 +813,29 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 813 | `cyclic-variable-indirection' if SYMBOL's chain of variable | 813 | `cyclic-variable-indirection' if SYMBOL's chain of variable |
| 814 | indirections contains a loop. */ | 814 | indirections contains a loop. */ |
| 815 | 815 | ||
| 816 | Lisp_Object | 816 | struct Lisp_Symbol * |
| 817 | indirect_variable (symbol) | 817 | indirect_variable (symbol) |
| 818 | Lisp_Object symbol; | 818 | struct Lisp_Symbol *symbol; |
| 819 | { | 819 | { |
| 820 | Lisp_Object tortoise, hare; | 820 | struct Lisp_Symbol *tortoise, *hare; |
| 821 | 821 | ||
| 822 | hare = tortoise = symbol; | 822 | hare = tortoise = symbol; |
| 823 | 823 | ||
| 824 | while (XSYMBOL (hare)->indirect_variable) | 824 | while (hare->indirect_variable) |
| 825 | { | 825 | { |
| 826 | hare = XSYMBOL (hare)->value; | 826 | hare = XSYMBOL (hare->value); |
| 827 | if (!XSYMBOL (hare)->indirect_variable) | 827 | if (!hare->indirect_variable) |
| 828 | break; | 828 | break; |
| 829 | 829 | ||
| 830 | hare = XSYMBOL (hare)->value; | 830 | hare = XSYMBOL (hare->value); |
| 831 | tortoise = XSYMBOL (tortoise)->value; | 831 | tortoise = XSYMBOL (tortoise->value); |
| 832 | 832 | ||
| 833 | if (EQ (hare, tortoise)) | 833 | if (hare == tortoise) |
| 834 | xsignal1 (Qcyclic_variable_indirection, symbol); | 834 | { |
| 835 | Lisp_Object tem; | ||
| 836 | XSETSYMBOL (tem, symbol); | ||
| 837 | xsignal1 (Qcyclic_variable_indirection, tem); | ||
| 838 | } | ||
| 835 | } | 839 | } |
| 836 | 840 | ||
| 837 | return hare; | 841 | return hare; |
| @@ -848,7 +852,7 @@ variable chain of symbols. */) | |||
| 848 | Lisp_Object object; | 852 | Lisp_Object object; |
| 849 | { | 853 | { |
| 850 | if (SYMBOLP (object)) | 854 | if (SYMBOLP (object)) |
| 851 | object = indirect_variable (object); | 855 | XSETSYMBOL (object, indirect_variable (XSYMBOL (object))); |
| 852 | return object; | 856 | return object; |
| 853 | } | 857 | } |
| 854 | 858 | ||
| @@ -972,7 +976,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) | |||
| 972 | 976 | ||
| 973 | if (! NILP (type) && ! NILP (newval) | 977 | if (! NILP (type) && ! NILP (newval) |
| 974 | && XTYPE (newval) != XINT (type)) | 978 | && XTYPE (newval) != XINT (type)) |
| 975 | buffer_slot_type_mismatch (symbol, XINT (type)); | 979 | buffer_slot_type_mismatch (newval, XINT (type)); |
| 976 | 980 | ||
| 977 | if (buf == NULL) | 981 | if (buf == NULL) |
| 978 | buf = current_buffer; | 982 | buf = current_buffer; |
| @@ -1049,8 +1053,12 @@ swap_in_symval_forwarding (symbol, valcontents) | |||
| 1049 | || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame | 1053 | || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame |
| 1050 | && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) | 1054 | && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) |
| 1051 | { | 1055 | { |
| 1052 | if (XSYMBOL (symbol)->indirect_variable) | 1056 | struct Lisp_Symbol *sym = XSYMBOL (symbol); |
| 1053 | symbol = indirect_variable (symbol); | 1057 | if (sym->indirect_variable) |
| 1058 | { | ||
| 1059 | sym = indirect_variable (sym); | ||
| 1060 | XSETSYMBOL (symbol, sym); | ||
| 1061 | } | ||
| 1054 | 1062 | ||
| 1055 | /* Unload the previously loaded binding. */ | 1063 | /* Unload the previously loaded binding. */ |
| 1056 | tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | 1064 | tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); |
| @@ -1132,7 +1140,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, | |||
| 1132 | 1140 | ||
| 1133 | static int | 1141 | static int |
| 1134 | let_shadows_buffer_binding_p (symbol) | 1142 | let_shadows_buffer_binding_p (symbol) |
| 1135 | Lisp_Object symbol; | 1143 | struct Lisp_Symbol *symbol; |
| 1136 | { | 1144 | { |
| 1137 | volatile struct specbinding *p; | 1145 | volatile struct specbinding *p; |
| 1138 | 1146 | ||
| @@ -1140,10 +1148,10 @@ let_shadows_buffer_binding_p (symbol) | |||
| 1140 | if (p->func == NULL | 1148 | if (p->func == NULL |
| 1141 | && CONSP (p->symbol)) | 1149 | && CONSP (p->symbol)) |
| 1142 | { | 1150 | { |
| 1143 | Lisp_Object let_bound_symbol = XCAR (p->symbol); | 1151 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); |
| 1144 | if ((EQ (symbol, let_bound_symbol) | 1152 | if ((symbol == let_bound_symbol |
| 1145 | || (XSYMBOL (let_bound_symbol)->indirect_variable | 1153 | || (let_bound_symbol->indirect_variable |
| 1146 | && EQ (symbol, indirect_variable (let_bound_symbol)))) | 1154 | && symbol == indirect_variable (let_bound_symbol))) |
| 1147 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | 1155 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) |
| 1148 | break; | 1156 | break; |
| 1149 | } | 1157 | } |
| @@ -1197,7 +1205,7 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 1197 | { | 1205 | { |
| 1198 | /* valcontents is a struct Lisp_Buffer_Local_Value. */ | 1206 | /* valcontents is a struct Lisp_Buffer_Local_Value. */ |
| 1199 | if (XSYMBOL (symbol)->indirect_variable) | 1207 | if (XSYMBOL (symbol)->indirect_variable) |
| 1200 | symbol = indirect_variable (symbol); | 1208 | XSETSYMBOL (symbol, indirect_variable (XSYMBOL (symbol))); |
| 1201 | 1209 | ||
| 1202 | /* What binding is loaded right now? */ | 1210 | /* What binding is loaded right now? */ |
| 1203 | current_alist_element | 1211 | current_alist_element |
| @@ -1239,7 +1247,7 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 1239 | Likewise if the variable has been let-bound | 1247 | Likewise if the variable has been let-bound |
| 1240 | in the current buffer. */ | 1248 | in the current buffer. */ |
| 1241 | if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set | 1249 | if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set |
| 1242 | || let_shadows_buffer_binding_p (symbol)) | 1250 | || let_shadows_buffer_binding_p (XSYMBOL (symbol))) |
| 1243 | { | 1251 | { |
| 1244 | XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; | 1252 | XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; |
| 1245 | 1253 | ||
| @@ -1473,13 +1481,14 @@ The function `default-value' gets the default value and `set-default' sets it. | |||
| 1473 | register Lisp_Object variable; | 1481 | register Lisp_Object variable; |
| 1474 | { | 1482 | { |
| 1475 | register Lisp_Object tem, valcontents, newval; | 1483 | register Lisp_Object tem, valcontents, newval; |
| 1484 | struct Lisp_Symbol *sym; | ||
| 1476 | 1485 | ||
| 1477 | CHECK_SYMBOL (variable); | 1486 | CHECK_SYMBOL (variable); |
| 1478 | variable = indirect_variable (variable); | 1487 | sym = indirect_variable (XSYMBOL (variable)); |
| 1479 | 1488 | ||
| 1480 | valcontents = SYMBOL_VALUE (variable); | 1489 | valcontents = sym->value; |
| 1481 | if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents)) | 1490 | if (sym->constant || KBOARD_OBJFWDP (valcontents)) |
| 1482 | error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); | 1491 | error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); |
| 1483 | 1492 | ||
| 1484 | if (BUFFER_OBJFWDP (valcontents)) | 1493 | if (BUFFER_OBJFWDP (valcontents)) |
| 1485 | return variable; | 1494 | return variable; |
| @@ -1488,19 +1497,19 @@ The function `default-value' gets the default value and `set-default' sets it. | |||
| 1488 | else | 1497 | else |
| 1489 | { | 1498 | { |
| 1490 | if (EQ (valcontents, Qunbound)) | 1499 | if (EQ (valcontents, Qunbound)) |
| 1491 | SET_SYMBOL_VALUE (variable, Qnil); | 1500 | sym->value = Qnil; |
| 1492 | tem = Fcons (Qnil, Fsymbol_value (variable)); | 1501 | tem = Fcons (Qnil, Fsymbol_value (variable)); |
| 1493 | XSETCAR (tem, tem); | 1502 | XSETCAR (tem, tem); |
| 1494 | newval = allocate_misc (); | 1503 | newval = allocate_misc (); |
| 1495 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; | 1504 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; |
| 1496 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); | 1505 | XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; |
| 1497 | XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); | 1506 | XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); |
| 1498 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1507 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1499 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; | 1508 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; |
| 1500 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1509 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1501 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; | 1510 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; |
| 1502 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1511 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1503 | SET_SYMBOL_VALUE (variable, newval); | 1512 | sym->value = newval; |
| 1504 | } | 1513 | } |
| 1505 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1; | 1514 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1; |
| 1506 | return variable; | 1515 | return variable; |
| @@ -1530,13 +1539,14 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1530 | register Lisp_Object variable; | 1539 | register Lisp_Object variable; |
| 1531 | { | 1540 | { |
| 1532 | register Lisp_Object tem, valcontents; | 1541 | register Lisp_Object tem, valcontents; |
| 1542 | struct Lisp_Symbol *sym; | ||
| 1533 | 1543 | ||
| 1534 | CHECK_SYMBOL (variable); | 1544 | CHECK_SYMBOL (variable); |
| 1535 | variable = indirect_variable (variable); | 1545 | sym = indirect_variable (XSYMBOL (variable)); |
| 1536 | 1546 | ||
| 1537 | valcontents = SYMBOL_VALUE (variable); | 1547 | valcontents = sym->value; |
| 1538 | if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents)) | 1548 | if (sym->constant || KBOARD_OBJFWDP (valcontents)) |
| 1539 | error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); | 1549 | error ("Symbol %s may not be buffer-local", SDATA (sym->xname)); |
| 1540 | 1550 | ||
| 1541 | if ((BUFFER_LOCAL_VALUEP (valcontents) | 1551 | if ((BUFFER_LOCAL_VALUEP (valcontents) |
| 1542 | && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) | 1552 | && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) |
| @@ -1557,7 +1567,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1557 | XSETCAR (tem, tem); | 1567 | XSETCAR (tem, tem); |
| 1558 | newval = allocate_misc (); | 1568 | newval = allocate_misc (); |
| 1559 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; | 1569 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; |
| 1560 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); | 1570 | XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; |
| 1561 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; | 1571 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; |
| 1562 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1572 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1563 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; | 1573 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; |
| @@ -1565,9 +1575,10 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1565 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1575 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1566 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; | 1576 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; |
| 1567 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1577 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1568 | SET_SYMBOL_VALUE (variable, newval); | 1578 | sym->value = newval; |
| 1569 | } | 1579 | } |
| 1570 | /* Make sure this buffer has its own value of symbol. */ | 1580 | /* Make sure this buffer has its own value of symbol. */ |
| 1581 | XSETSYMBOL (variable, sym); /* Propagate variable indirections. */ | ||
| 1571 | tem = Fassq (variable, current_buffer->local_var_alist); | 1582 | tem = Fassq (variable, current_buffer->local_var_alist); |
| 1572 | if (NILP (tem)) | 1583 | if (NILP (tem)) |
| 1573 | { | 1584 | { |
| @@ -1577,7 +1588,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1577 | find_symbol_value (variable); | 1588 | find_symbol_value (variable); |
| 1578 | 1589 | ||
| 1579 | current_buffer->local_var_alist | 1590 | current_buffer->local_var_alist |
| 1580 | = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (variable))->cdr)), | 1591 | = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (sym->value)->cdr)), |
| 1581 | current_buffer->local_var_alist); | 1592 | current_buffer->local_var_alist); |
| 1582 | 1593 | ||
| 1583 | /* Make sure symbol does not think it is set up for this buffer; | 1594 | /* Make sure symbol does not think it is set up for this buffer; |
| @@ -1585,7 +1596,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1585 | { | 1596 | { |
| 1586 | Lisp_Object *pvalbuf; | 1597 | Lisp_Object *pvalbuf; |
| 1587 | 1598 | ||
| 1588 | valcontents = SYMBOL_VALUE (variable); | 1599 | valcontents = sym->value; |
| 1589 | 1600 | ||
| 1590 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 1601 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 1591 | if (current_buffer == XBUFFER (*pvalbuf)) | 1602 | if (current_buffer == XBUFFER (*pvalbuf)) |
| @@ -1598,9 +1609,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1598 | for this buffer now. If C code modifies the variable before we | 1609 | for this buffer now. If C code modifies the variable before we |
| 1599 | load the binding in, then that new value will clobber the default | 1610 | load the binding in, then that new value will clobber the default |
| 1600 | binding the next time we unload it. */ | 1611 | binding the next time we unload it. */ |
| 1601 | valcontents = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (variable))->realvalue; | 1612 | valcontents = XBUFFER_LOCAL_VALUE (sym->value)->realvalue; |
| 1602 | if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) | 1613 | if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) |
| 1603 | swap_in_symval_forwarding (variable, SYMBOL_VALUE (variable)); | 1614 | swap_in_symval_forwarding (variable, sym->value); |
| 1604 | 1615 | ||
| 1605 | return variable; | 1616 | return variable; |
| 1606 | } | 1617 | } |
| @@ -1613,11 +1624,12 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) | |||
| 1613 | register Lisp_Object variable; | 1624 | register Lisp_Object variable; |
| 1614 | { | 1625 | { |
| 1615 | register Lisp_Object tem, valcontents; | 1626 | register Lisp_Object tem, valcontents; |
| 1627 | struct Lisp_Symbol *sym; | ||
| 1616 | 1628 | ||
| 1617 | CHECK_SYMBOL (variable); | 1629 | CHECK_SYMBOL (variable); |
| 1618 | variable = indirect_variable (variable); | 1630 | sym = indirect_variable (XSYMBOL (variable)); |
| 1619 | 1631 | ||
| 1620 | valcontents = SYMBOL_VALUE (variable); | 1632 | valcontents = sym->value; |
| 1621 | 1633 | ||
| 1622 | if (BUFFER_OBJFWDP (valcontents)) | 1634 | if (BUFFER_OBJFWDP (valcontents)) |
| 1623 | { | 1635 | { |
| @@ -1637,7 +1649,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) | |||
| 1637 | return variable; | 1649 | return variable; |
| 1638 | 1650 | ||
| 1639 | /* Get rid of this buffer's alist element, if any. */ | 1651 | /* Get rid of this buffer's alist element, if any. */ |
| 1640 | 1652 | XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ | |
| 1641 | tem = Fassq (variable, current_buffer->local_var_alist); | 1653 | tem = Fassq (variable, current_buffer->local_var_alist); |
| 1642 | if (!NILP (tem)) | 1654 | if (!NILP (tem)) |
| 1643 | current_buffer->local_var_alist | 1655 | current_buffer->local_var_alist |
| @@ -1648,7 +1660,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) | |||
| 1648 | forwarded objects won't work right. */ | 1660 | forwarded objects won't work right. */ |
| 1649 | { | 1661 | { |
| 1650 | Lisp_Object *pvalbuf, buf; | 1662 | Lisp_Object *pvalbuf, buf; |
| 1651 | valcontents = SYMBOL_VALUE (variable); | 1663 | valcontents = sym->value; |
| 1652 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 1664 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 1653 | XSETBUFFER (buf, current_buffer); | 1665 | XSETBUFFER (buf, current_buffer); |
| 1654 | if (EQ (buf, *pvalbuf)) | 1666 | if (EQ (buf, *pvalbuf)) |
| @@ -1685,14 +1697,15 @@ Buffer-local bindings take precedence over frame-local bindings. */) | |||
| 1685 | register Lisp_Object variable; | 1697 | register Lisp_Object variable; |
| 1686 | { | 1698 | { |
| 1687 | register Lisp_Object tem, valcontents, newval; | 1699 | register Lisp_Object tem, valcontents, newval; |
| 1700 | struct Lisp_Symbol *sym; | ||
| 1688 | 1701 | ||
| 1689 | CHECK_SYMBOL (variable); | 1702 | CHECK_SYMBOL (variable); |
| 1690 | variable = indirect_variable (variable); | 1703 | sym = indirect_variable (XSYMBOL (variable)); |
| 1691 | 1704 | ||
| 1692 | valcontents = SYMBOL_VALUE (variable); | 1705 | valcontents = sym->value; |
| 1693 | if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents) | 1706 | if (sym->constant || KBOARD_OBJFWDP (valcontents) |
| 1694 | || BUFFER_OBJFWDP (valcontents)) | 1707 | || BUFFER_OBJFWDP (valcontents)) |
| 1695 | error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); | 1708 | error ("Symbol %s may not be frame-local", SDATA (sym->xname)); |
| 1696 | 1709 | ||
| 1697 | if (BUFFER_LOCAL_VALUEP (valcontents)) | 1710 | if (BUFFER_LOCAL_VALUEP (valcontents)) |
| 1698 | { | 1711 | { |
| @@ -1701,12 +1714,12 @@ Buffer-local bindings take precedence over frame-local bindings. */) | |||
| 1701 | } | 1714 | } |
| 1702 | 1715 | ||
| 1703 | if (EQ (valcontents, Qunbound)) | 1716 | if (EQ (valcontents, Qunbound)) |
| 1704 | SET_SYMBOL_VALUE (variable, Qnil); | 1717 | sym->value = Qnil; |
| 1705 | tem = Fcons (Qnil, Fsymbol_value (variable)); | 1718 | tem = Fcons (Qnil, Fsymbol_value (variable)); |
| 1706 | XSETCAR (tem, tem); | 1719 | XSETCAR (tem, tem); |
| 1707 | newval = allocate_misc (); | 1720 | newval = allocate_misc (); |
| 1708 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; | 1721 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; |
| 1709 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); | 1722 | XBUFFER_LOCAL_VALUE (newval)->realvalue = sym->value; |
| 1710 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; | 1723 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; |
| 1711 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1724 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1712 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; | 1725 | XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0; |
| @@ -1714,7 +1727,7 @@ Buffer-local bindings take precedence over frame-local bindings. */) | |||
| 1714 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1727 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1715 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; | 1728 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; |
| 1716 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1729 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1717 | SET_SYMBOL_VALUE (variable, newval); | 1730 | sym->value = newval; |
| 1718 | return variable; | 1731 | return variable; |
| 1719 | } | 1732 | } |
| 1720 | 1733 | ||
| @@ -1727,6 +1740,7 @@ BUFFER defaults to the current buffer. */) | |||
| 1727 | { | 1740 | { |
| 1728 | Lisp_Object valcontents; | 1741 | Lisp_Object valcontents; |
| 1729 | register struct buffer *buf; | 1742 | register struct buffer *buf; |
| 1743 | struct Lisp_Symbol *sym; | ||
| 1730 | 1744 | ||
| 1731 | if (NILP (buffer)) | 1745 | if (NILP (buffer)) |
| 1732 | buf = current_buffer; | 1746 | buf = current_buffer; |
| @@ -1737,9 +1751,10 @@ BUFFER defaults to the current buffer. */) | |||
| 1737 | } | 1751 | } |
| 1738 | 1752 | ||
| 1739 | CHECK_SYMBOL (variable); | 1753 | CHECK_SYMBOL (variable); |
| 1740 | variable = indirect_variable (variable); | 1754 | sym = indirect_variable (XSYMBOL (variable)); |
| 1741 | 1755 | XSETSYMBOL (variable, sym); | |
| 1742 | valcontents = SYMBOL_VALUE (variable); | 1756 | |
| 1757 | valcontents = sym->value; | ||
| 1743 | if (BUFFER_LOCAL_VALUEP (valcontents)) | 1758 | if (BUFFER_LOCAL_VALUEP (valcontents)) |
| 1744 | { | 1759 | { |
| 1745 | Lisp_Object tail, elt; | 1760 | Lisp_Object tail, elt; |
| @@ -1774,6 +1789,7 @@ BUFFER defaults to the current buffer. */) | |||
| 1774 | { | 1789 | { |
| 1775 | Lisp_Object valcontents; | 1790 | Lisp_Object valcontents; |
| 1776 | register struct buffer *buf; | 1791 | register struct buffer *buf; |
| 1792 | struct Lisp_Symbol *sym; | ||
| 1777 | 1793 | ||
| 1778 | if (NILP (buffer)) | 1794 | if (NILP (buffer)) |
| 1779 | buf = current_buffer; | 1795 | buf = current_buffer; |
| @@ -1784,9 +1800,10 @@ BUFFER defaults to the current buffer. */) | |||
| 1784 | } | 1800 | } |
| 1785 | 1801 | ||
| 1786 | CHECK_SYMBOL (variable); | 1802 | CHECK_SYMBOL (variable); |
| 1787 | variable = indirect_variable (variable); | 1803 | sym = indirect_variable (XSYMBOL (variable)); |
| 1804 | XSETSYMBOL (variable, sym); | ||
| 1788 | 1805 | ||
| 1789 | valcontents = SYMBOL_VALUE (variable); | 1806 | valcontents = sym->value; |
| 1790 | 1807 | ||
| 1791 | if (BUFFER_OBJFWDP (valcontents)) | 1808 | if (BUFFER_OBJFWDP (valcontents)) |
| 1792 | /* All these slots become local if they are set. */ | 1809 | /* All these slots become local if they are set. */ |
| @@ -1816,14 +1833,15 @@ If the current binding is global (the default), the value is nil. */) | |||
| 1816 | register Lisp_Object variable; | 1833 | register Lisp_Object variable; |
| 1817 | { | 1834 | { |
| 1818 | Lisp_Object valcontents; | 1835 | Lisp_Object valcontents; |
| 1836 | struct Lisp_Symbol *sym; | ||
| 1819 | 1837 | ||
| 1820 | CHECK_SYMBOL (variable); | 1838 | CHECK_SYMBOL (variable); |
| 1821 | variable = indirect_variable (variable); | 1839 | sym = indirect_variable (XSYMBOL (variable)); |
| 1822 | 1840 | ||
| 1823 | /* Make sure the current binding is actually swapped in. */ | 1841 | /* Make sure the current binding is actually swapped in. */ |
| 1824 | find_symbol_value (variable); | 1842 | find_symbol_value (variable); |
| 1825 | 1843 | ||
| 1826 | valcontents = XSYMBOL (variable)->value; | 1844 | valcontents = sym->value; |
| 1827 | 1845 | ||
| 1828 | if (BUFFER_LOCAL_VALUEP (valcontents) | 1846 | if (BUFFER_LOCAL_VALUEP (valcontents) |
| 1829 | || BUFFER_OBJFWDP (valcontents)) | 1847 | || BUFFER_OBJFWDP (valcontents)) |
diff --git a/src/lisp.h b/src/lisp.h index 9b042e57ae0..5fcbd23df88 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -993,7 +993,7 @@ struct Lisp_Symbol | |||
| 993 | 993 | ||
| 994 | #define SYMBOL_VALUE(sym) \ | 994 | #define SYMBOL_VALUE(sym) \ |
| 995 | (XSYMBOL (sym)->indirect_variable \ | 995 | (XSYMBOL (sym)->indirect_variable \ |
| 996 | ? XSYMBOL (indirect_variable (sym))->value \ | 996 | ? indirect_variable (XSYMBOL (sym))->value \ |
| 997 | : XSYMBOL (sym)->value) | 997 | : XSYMBOL (sym)->value) |
| 998 | 998 | ||
| 999 | /* Set SYM's value to VAL, taking defvaralias into account. */ | 999 | /* Set SYM's value to VAL, taking defvaralias into account. */ |
| @@ -1001,7 +1001,7 @@ struct Lisp_Symbol | |||
| 1001 | #define SET_SYMBOL_VALUE(sym, val) \ | 1001 | #define SET_SYMBOL_VALUE(sym, val) \ |
| 1002 | do { \ | 1002 | do { \ |
| 1003 | if (XSYMBOL (sym)->indirect_variable) \ | 1003 | if (XSYMBOL (sym)->indirect_variable) \ |
| 1004 | XSYMBOL (indirect_variable ((sym)))->value = (val); \ | 1004 | indirect_variable (XSYMBOL (sym))->value = (val); \ |
| 1005 | else \ | 1005 | else \ |
| 1006 | XSYMBOL (sym)->value = (val); \ | 1006 | XSYMBOL (sym)->value = (val); \ |
| 1007 | } while (0) | 1007 | } while (0) |
| @@ -2263,7 +2263,7 @@ EXFUN (Fadd1, 1); | |||
| 2263 | EXFUN (Fsub1, 1); | 2263 | EXFUN (Fsub1, 1); |
| 2264 | EXFUN (Fmake_variable_buffer_local, 1); | 2264 | EXFUN (Fmake_variable_buffer_local, 1); |
| 2265 | 2265 | ||
| 2266 | extern Lisp_Object indirect_variable P_ ((Lisp_Object)); | 2266 | extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *); |
| 2267 | extern Lisp_Object long_to_cons P_ ((unsigned long)); | 2267 | extern Lisp_Object long_to_cons P_ ((unsigned long)); |
| 2268 | extern unsigned long cons_to_long P_ ((Lisp_Object)); | 2268 | extern unsigned long cons_to_long P_ ((Lisp_Object)); |
| 2269 | extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; | 2269 | extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; |