aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorRichard M. Stallman2000-01-11 22:18:09 +0000
committerRichard M. Stallman2000-01-11 22:18:09 +0000
commit2829d05f57301e7f397be3a6bd92af3e56acdf64 (patch)
tree56a1e45b5709ee2389690f116563f17118644eaf /src/data.c
parentc96d71f715f902111f78be44d5053ea3d5c3edc0 (diff)
downloademacs-2829d05f57301e7f397be3a6bd92af3e56acdf64.tar.gz
emacs-2829d05f57301e7f397be3a6bd92af3e56acdf64.zip
(set_internal): New arg BUF.
(Fset): Pass new arg to set_internal.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/data.c b/src/data.c
index 82e050d2605..f4ee843a1a2 100644
--- a/src/data.c
+++ b/src/data.c
@@ -834,8 +834,8 @@ store_symval_forwarding (symbol, valcontents, newval)
834 } 834 }
835} 835}
836 836
837/* Set up the buffer-local symbol SYMBOL for validity in the current 837/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
838 buffer. VALCONTENTS is the contents of its value cell. 838 VALCONTENTS is the contents of its value cell.
839 Return the value forwarded one step past the buffer-local indicator. */ 839 Return the value forwarded one step past the buffer-local indicator. */
840 840
841static Lisp_Object 841static Lisp_Object
@@ -910,7 +910,8 @@ find_symbol_value (symbol)
910 910
911 if (BUFFER_LOCAL_VALUEP (valcontents) 911 if (BUFFER_LOCAL_VALUEP (valcontents)
912 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) 912 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
913 valcontents = swap_in_symval_forwarding (symbol, valcontents); 913 valcontents = swap_in_symval_forwarding (symbol, valcontents,
914 current_buffer);
914 915
915 if (MISCP (valcontents)) 916 if (MISCP (valcontents))
916 { 917 {
@@ -958,23 +959,34 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
958 (symbol, newval) 959 (symbol, newval)
959 register Lisp_Object symbol, newval; 960 register Lisp_Object symbol, newval;
960{ 961{
961 return set_internal (symbol, newval, 0); 962 return set_internal (symbol, newval, current_buffer, 0);
962} 963}
963 964
964/* Store the value NEWVAL into SYMBOL. 965/* Store the value NEWVAL into SYMBOL.
966 If buffer-locality is an issue, BUF specifies which buffer to use.
967 (0 stands for the current buffer.)
968
965 If BINDFLAG is zero, then if this symbol is supposed to become 969 If BINDFLAG is zero, then if this symbol is supposed to become
966 local in every buffer where it is set, then we make it local. 970 local in every buffer where it is set, then we make it local.
967 If BINDFLAG is nonzero, we don't do that. */ 971 If BINDFLAG is nonzero, we don't do that. */
968 972
969Lisp_Object 973Lisp_Object
970set_internal (symbol, newval, bindflag) 974set_internal (symbol, newval, buf, bindflag)
971 register Lisp_Object symbol, newval; 975 register Lisp_Object symbol, newval;
976 struct buffer *buf;
972 int bindflag; 977 int bindflag;
973{ 978{
974 int voide = EQ (newval, Qunbound); 979 int voide = EQ (newval, Qunbound);
975 980
976 register Lisp_Object valcontents, tem1, current_alist_element; 981 register Lisp_Object valcontents, tem1, current_alist_element;
977 982
983 if (buf == 0)
984 buf = current_buffer;
985
986 /* If restoring in a dead buffer, do nothing. */
987 if (NILP (buf->name))
988 return newval;
989
978 CHECK_SYMBOL (symbol, 0); 990 CHECK_SYMBOL (symbol, 0);
979 if (NILP (symbol) || EQ (symbol, Qt) 991 if (NILP (symbol) || EQ (symbol, Qt)
980 || (XSYMBOL (symbol)->name->data[0] == ':' 992 || (XSYMBOL (symbol)->name->data[0] == ':'
@@ -989,7 +1001,7 @@ set_internal (symbol, newval, bindflag)
989 register int mask = XINT (*((Lisp_Object *) 1001 register int mask = XINT (*((Lisp_Object *)
990 (idx + (char *)&buffer_local_flags))); 1002 (idx + (char *)&buffer_local_flags)));
991 if (mask > 0 && ! bindflag) 1003 if (mask > 0 && ! bindflag)
992 current_buffer->local_var_flags |= mask; 1004 buf->local_var_flags |= mask;
993 } 1005 }
994 1006
995 else if (BUFFER_LOCAL_VALUEP (valcontents) 1007 else if (BUFFER_LOCAL_VALUEP (valcontents)
@@ -1031,7 +1043,7 @@ set_internal (symbol, newval, bindflag)
1031 currently cached, or if it's a Lisp_Buffer_Local_Value and 1043 currently cached, or if it's a Lisp_Buffer_Local_Value and
1032 we're looking at the default value, the cache is invalid; we 1044 we're looking at the default value, the cache is invalid; we
1033 need to write it out, and find the new CURRENT-ALIST-ELEMENT. */ 1045 need to write it out, and find the new CURRENT-ALIST-ELEMENT. */
1034 if (current_buffer != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) 1046 if (buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer)
1035 || !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame) 1047 || !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)
1036 || (BUFFER_LOCAL_VALUEP (valcontents) 1048 || (BUFFER_LOCAL_VALUEP (valcontents)
1037 && EQ (XCAR (current_alist_element), 1049 && EQ (XCAR (current_alist_element),
@@ -1044,7 +1056,7 @@ set_internal (symbol, newval, bindflag)
1044 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); 1056 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue));
1045 1057
1046 /* Find the new value for CURRENT-ALIST-ELEMENT. */ 1058 /* Find the new value for CURRENT-ALIST-ELEMENT. */
1047 tem1 = Fassq (symbol, current_buffer->local_var_alist); 1059 tem1 = Fassq (symbol, buf->local_var_alist);
1048 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1; 1060 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1;
1049 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; 1061 XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0;
1050 1062
@@ -1075,8 +1087,8 @@ set_internal (symbol, newval, bindflag)
1075 else 1087 else
1076 { 1088 {
1077 tem1 = Fcons (symbol, Fcdr (current_alist_element)); 1089 tem1 = Fcons (symbol, Fcdr (current_alist_element));
1078 current_buffer->local_var_alist 1090 buf->local_var_alist
1079 = Fcons (tem1, current_buffer->local_var_alist); 1091 = Fcons (tem1, buf->local_var_alist);
1080 } 1092 }
1081 } 1093 }
1082 1094
@@ -1085,8 +1097,7 @@ set_internal (symbol, newval, bindflag)
1085 = tem1; 1097 = tem1;
1086 1098
1087 /* Set BUFFER and FRAME for binding now loaded. */ 1099 /* Set BUFFER and FRAME for binding now loaded. */
1088 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, 1100 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf);
1089 current_buffer);
1090 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; 1101 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame;
1091 } 1102 }
1092 valcontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; 1103 valcontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue;