comparison src/data.c @ 16931:8bdfc6767130

(set_internal): New subroutine. New arg BINDFLAG. Don't make a new buffer-local binding if BINDFLAG is 0. (Fset): Use set_internal.
author Richard M. Stallman <rms@gnu.org>
date Sat, 25 Jan 1997 20:19:30 +0000
parents 3ad557e686b9
children d6cd00b2e214
comparison
equal deleted inserted replaced
16930:e1aba4a05388 16931:8bdfc6767130
900 DEFUN ("set", Fset, Sset, 2, 2, 0, 900 DEFUN ("set", Fset, Sset, 2, 2, 0,
901 "Set SYMBOL's value to NEWVAL, and return NEWVAL.") 901 "Set SYMBOL's value to NEWVAL, and return NEWVAL.")
902 (symbol, newval) 902 (symbol, newval)
903 register Lisp_Object symbol, newval; 903 register Lisp_Object symbol, newval;
904 { 904 {
905 return set_internal (symbol, newval, 0);
906 }
907
908 /* Stpre the value NEWVAL into SYMBOL.
909 If BINDFLAG is zero, then if this symbol is supposed to become
910 local in every buffer where it is set, then we make it local.
911 If BINDFLAG is nonzero, we don't do that. */
912
913 Lisp_Object
914 set_internal (symbol, newval, bindflag)
915 register Lisp_Object symbol, newval;
916 int bindflag;
917 {
905 int voide = EQ (newval, Qunbound); 918 int voide = EQ (newval, Qunbound);
906 919
907 register Lisp_Object valcontents, tem1, current_alist_element; 920 register Lisp_Object valcontents, tem1, current_alist_element;
908 921
909 CHECK_SYMBOL (symbol, 0); 922 CHECK_SYMBOL (symbol, 0);
976 if (NILP (tem1)) 989 if (NILP (tem1))
977 { 990 {
978 /* This buffer still sees the default value. */ 991 /* This buffer still sees the default value. */
979 992
980 /* If the variable is a Lisp_Some_Buffer_Local_Value, 993 /* If the variable is a Lisp_Some_Buffer_Local_Value,
994 or if this is `let' rather than `set',
981 make CURRENT-ALIST-ELEMENT point to itself, 995 make CURRENT-ALIST-ELEMENT point to itself,
982 indicating that we're seeing the default value. */ 996 indicating that we're seeing the default value. */
983 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) 997 if (bindflag || SOME_BUFFER_LOCAL_VALUEP (valcontents))
984 tem1 = XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr; 998 tem1 = XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr;
985 999
986 /* If it's a Lisp_Buffer_Local_Value, give this buffer a 1000 /* If it's a Lisp_Buffer_Local_Value, being set not bound,
987 new assoc for a local value and set 1001 give this buffer a new assoc for a local value and set
988 CURRENT-ALIST-ELEMENT to point to that. */ 1002 CURRENT-ALIST-ELEMENT to point to that. */
989 else 1003 else
990 { 1004 {
991 tem1 = Fcons (symbol, Fcdr (current_alist_element)); 1005 tem1 = Fcons (symbol, Fcdr (current_alist_element));
992 current_buffer->local_var_alist = 1006 current_buffer->local_var_alist =