Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive;
Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
Lisp_Object Qtext_read_only;
+
Lisp_Object Qintegerp, Qnatnump, Qwholenump, Qsymbolp, Qlistp, Qconsp;
Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
Lisp_Object Qfloatp;
Lisp_Object Qnumberp, Qnumber_or_marker_p;
-static Lisp_Object Qinteger, Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
+Lisp_Object Qinteger;
+static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
static Lisp_Object Qfloat, Qwindow_configuration, Qwindow;
Lisp_Object Qprocess;
static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
}
DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
- doc: /* Set SYMBOL's property list to NEWVAL, and return NEWVAL. */)
+ doc: /* Set SYMBOL's property list to NEWPLIST, and return NEWPLIST. */)
(symbol, newplist)
register Lisp_Object symbol, newplist;
{
register Lisp_Object valcontents, newval;
struct buffer *buf;
{
+ int offset;
+
switch (SWITCH_ENUM_CAST (XTYPE (valcontents)))
{
case Lisp_Misc:
case Lisp_Misc_Objfwd:
*XOBJFWD (valcontents)->objvar = newval;
+
+ /* If this variable is a default for something stored
+ in the buffer itself, such as default-fill-column,
+ find the buffers that don't have local values for it
+ and update them. */
+ if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
+ && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1))
+ {
+ int offset = ((char *) XOBJFWD (valcontents)->objvar
+ - (char *) &buffer_defaults);
+ int idx = PER_BUFFER_IDX (offset);
+
+ Lisp_Object tail, buf;
+
+ if (idx <= 0)
+ break;
+
+ for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
+ {
+ Lisp_Object buf;
+ struct buffer *b;
+
+ buf = Fcdr (XCAR (tail));
+ if (!BUFFERP (buf)) continue;
+ b = XBUFFER (buf);
+
+ if (! PER_BUFFER_VALUE_P (b, idx))
+ PER_BUFFER_VALUE (b, offset) = newval;
+ }
+ }
break;
case Lisp_Misc_Buffer_Objfwd:
Lisp_Object type;
type = PER_BUFFER_TYPE (offset);
- if (XINT (type) == -1)
- error ("Variable %s is read-only", SDATA (SYMBOL_NAME (symbol)));
-
if (! NILP (type) && ! NILP (newval)
&& XTYPE (newval) != XINT (type))
buffer_slot_type_mismatch (offset);
let_shadows_buffer_binding_p (symbol)
Lisp_Object symbol;
{
- struct specbinding *p;
+ volatile struct specbinding *p;
for (p = specpdl_ptr - 1; p >= specpdl; p--)
if (p->func == NULL
register Lisp_Object tem, valcontents, newval;
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
register Lisp_Object tem, valcontents;
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
register Lisp_Object tem, valcontents;
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
loaded, recompute its value. We have to do it now, or else
forwarded objects won't work right. */
{
- Lisp_Object *pvalbuf;
+ Lisp_Object *pvalbuf, buf;
valcontents = SYMBOL_VALUE (variable);
pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer;
- if (current_buffer == XBUFFER (*pvalbuf))
+ XSETBUFFER (buf, current_buffer);
+ if (EQ (buf, *pvalbuf))
{
*pvalbuf = Qnil;
XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
register Lisp_Object tem, valcontents, newval;
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)
}
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
if (BUFFER_LOCAL_VALUEP (valcontents)
{
Lisp_Object tail, elt;
- variable = indirect_variable (variable);
for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
{
elt = XCAR (tail);
}
CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
}
return Qnil;
}
+
+DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus,
+ 1, 1, 0,
+ doc: /* Return a value indicating where VARIABLE's current binding comes from.
+If the current binding is buffer-local, the value is the current buffer.
+If the current binding is frame-local, the value is the selected frame.
+If the current binding is global (the default), the value is nil. */)
+ (variable)
+ register Lisp_Object variable;
+{
+ Lisp_Object valcontents;
+
+ CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
+
+ /* Make sure the current binding is actually swapped in. */
+ find_symbol_value (variable);
+
+ valcontents = XSYMBOL (variable)->value;
+
+ if (BUFFER_LOCAL_VALUEP (valcontents)
+ || SOME_BUFFER_LOCAL_VALUEP (valcontents)
+ || BUFFER_OBJFWDP (valcontents))
+ {
+ /* For a local variable, record both the symbol and which
+ buffer's or frame's value we are saving. */
+ if (!NILP (Flocal_variable_p (variable, Qnil)))
+ return Fcurrent_buffer ();
+ else if (!BUFFER_OBJFWDP (valcontents)
+ && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
+ return XBUFFER_LOCAL_VALUE (valcontents)->frame;
+ }
+
+ return Qnil;
+}
\f
/* Find the function at the end of a chain of symbol function indirections. */
}
else if (STRING_MULTIBYTE (array))
{
- int idxval_byte, prev_bytes, new_bytes;
+ int idxval_byte, prev_bytes, new_bytes, nbytes;
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
CHECK_NUMBER (newelt);
+ nbytes = SBYTES (array);
+
idxval_byte = string_char_to_byte (array, idxval);
p1 = SDATA (array) + idxval_byte;
PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes);
{
/* We must relocate the string data. */
int nchars = SCHARS (array);
- int nbytes = SBYTES (array);
unsigned char *str;
str = (nbytes <= MAX_ALLOCA
defsubr (&Smake_variable_frame_local);
defsubr (&Slocal_variable_p);
defsubr (&Slocal_variable_if_set_p);
+ defsubr (&Svariable_binding_locus);
defsubr (&Saref);
defsubr (&Saset);
defsubr (&Snumber_to_string);
signal (SIGEMT, arith_error);
#endif /* uts */
}
+
+/* arch-tag: 25879798-b84d-479a-9c89-7d148e2109f7
+ (do not change this comment) */