CHECK_SYMBOL (symbol, 0);
if (NILP (symbol) || EQ (symbol, Qt)
|| (XSYMBOL (symbol)->name->data[0] == ':'
- && XSYMBOL (symbol)->obarray == initial_obarray
+ && EQ (XSYMBOL (symbol)->obarray, initial_obarray)
&& keyword_symbols_constant_flag))
return Fsignal (Qsetting_constant, Fcons (symbol, Qnil));
Fset (symbol, Qunbound);
CHECK_SYMBOL (symbol, 0);
if (NILP (symbol) || EQ (symbol, Qt)
|| (XSYMBOL (symbol)->name->data[0] == ':'
- && XSYMBOL (symbol)->obarray == initial_obarray
+ && EQ (XSYMBOL (symbol)->obarray, initial_obarray)
&& keyword_symbols_constant_flag && ! EQ (newval, symbol)))
return Fsignal (Qsetting_constant, Fcons (symbol, Qnil));
valcontents = XSYMBOL (symbol)->value;
Other buffers will continue to share a common default value.\n\
\(The buffer-local value of VARIABLE starts out as the same value\n\
VARIABLE previously had. If VARIABLE was void, it remains void.\)\n\
-See also `make-variable-buffer-local'.\n\n\
+See also `make-variable-buffer-local'.\n\
+\n\
If the variable is already arranged to become local when set,\n\
this function causes a local value to exist for this buffer,\n\
just as setting the variable would do.\n\
\n\
+This function returns VARIABLE, and therefore\n\
+ (set (make-local-variable 'VARIABLE) VALUE-EXP)\n\
+works.\n\
+\n\
Do not use `make-local-variable' to make a hook variable buffer-local.\n\
Use `make-local-hook' instead.")
(variable)
}
else if (STRING_MULTIBYTE (array))
{
- Lisp_Object new_len;
- int c, idxval_byte, actual_len;
- unsigned char *p, *str;
+ int c, idxval_byte, new_len, actual_len;
+ int prev_byte;
+ unsigned char *p, workbuf[4], *str;
if (idxval < 0 || idxval >= XSTRING (array)->size)
args_out_of_range (array, idx);
idxval_byte = string_char_to_byte (array, idxval);
p = &XSTRING (array)->data[idxval_byte];
- actual_len
- = MULTIBYTE_FORM_LENGTH (p, STRING_BYTES (XSTRING (array)) - idxval_byte);
- new_len = Fchar_bytes (newelt);
- if (actual_len != XINT (new_len))
+ actual_len = MULTIBYTE_FORM_LENGTH (p, STRING_BYTES (XSTRING (array)));
+ CHECK_NUMBER (newelt, 2);
+ new_len = CHAR_STRING (XINT (newelt), workbuf, str);
+ if (actual_len != new_len)
error ("Attempt to change byte length of a string");
- CHAR_STRING (XINT (newelt), p, str);
- if (p != str)
- bcopy (str, p, actual_len);
+ /* We can't accept a change causing byte combining. */
+ if ((idxval > 0 && !CHAR_HEAD_P (*str)
+ && (prev_byte = string_char_to_byte (array, idxval - 1),
+ (prev_byte + 1 < idxval_byte
+ || (p[-1] >= 0x80 && p[-1] < 0xA0))))
+ || (idxval < XSTRING (array)->size - 1
+ && (*str >=0x80 && *str < 0xA0)
+ && !CHAR_HEAD_P (p[actual_len])))
+ error ("Attempt to change char length of a string");
+ while (new_len--)
+ *p++ = *str++;
}
else
{
\n\
If BASE, interpret STRING as a number in that base. If BASE isn't\n\
present, base 10 is used. BASE must be between 2 and 16 (inclusive).\n\
-Floating point numbers always use base 10.")
+If the base used is not 10, floating point is not recognized.")
(string, base)
register Lisp_Object string, base;
{
p++;
#ifdef LISP_FLOAT_TYPE
- if (isfloat_string (p))
+ if (isfloat_string (p) && b == 10)
return make_float (negative * atof (p));
#endif /* LISP_FLOAT_TYPE */
{
case Aadd: accum += next; break;
case Asub:
- if (!argnum && nargs != 1)
- next = - next;
- accum -= next;
+ accum = argnum ? accum - next : nargs == 1 ? - next : next;
break;
case Amult: accum *= next; break;
case Adiv:
accum += next;
break;
case Asub:
- if (!argnum && nargs != 1)
- next = - next;
- accum -= next;
+ accum = argnum ? accum - next : nargs == 1 ? - next : next;
break;
case Amult:
accum *= next;