(lw_separator_p): Add `--:space' with the same
[bpt/emacs.git] / src / data.c
index da9d86f..c1cfb81 100644 (file)
@@ -693,17 +693,7 @@ Associates the function with the current load file, if any.")
   (symbol, definition)
      register Lisp_Object symbol, definition;
 {
-  CHECK_SYMBOL (symbol, 0);
-  if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound))
-    Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function),
-                            Vautoload_queue);
-  XSYMBOL (symbol)->function = definition;
-  /* Handle automatic advice activation */
-  if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, Qad_advice_info)))
-    {
-      call2 (Qad_activate, symbol, Qnil);
-      definition = XSYMBOL (symbol)->function;
-    }
+  definition = Ffset (symbol, definition);
   LOADHIST_ATTACH (symbol);
   return definition;
 }
@@ -980,7 +970,7 @@ set_internal (symbol, newval, bindflag)
       register int idx = XBUFFER_OBJFWD (valcontents)->offset;
       register int mask = XINT (*((Lisp_Object *)
                                  (idx + (char *)&buffer_local_flags)));
-      if (mask > 0)
+      if (mask > 0 && ! bindflag)
        current_buffer->local_var_flags |= mask;
     }
 
@@ -1853,8 +1843,8 @@ IDX starts at 0.")
   else if (STRING_MULTIBYTE (array))
     {
       int c, idxval_byte, new_len, actual_len;
+      int prev_byte;
       unsigned char *p, workbuf[4], *str;
-      int recount = 0;
 
       if (idxval < 0 || idxval >= XSTRING (array)->size)
        args_out_of_range (array, idx);
@@ -1862,25 +1852,24 @@ IDX starts at 0.")
       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);
+      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");
-      if (!CHAR_HEAD_P (*str)
-         || !CHAR_HEAD_P (XSTRING (array)->data[idxval_byte + actual_len]))
-       /* We may have to combine bytes.  */
-       recount = 1;
+
+      /* We can't accept a change causing byte combining.  */
+      if (!ASCII_BYTE_P (*str)
+         && ((idxval > 0 && !CHAR_HEAD_P (*str)
+              && (prev_byte = string_char_to_byte (array, idxval - 1),
+                  BYTES_BY_CHAR_HEAD (XSTRING (array)->data[prev_byte])
+                  > idxval_byte - prev_byte))
+             || (idxval < XSTRING (array)->size - 1
+                 && !CHAR_HEAD_P (p[actual_len])
+                 && new_len < BYTES_BY_CHAR_HEAD (*str))))
+       error ("Attempt to change char length of a string");
       while (new_len--)
        *p++ = *str++;
-      if (recount)
-       {
-         XSTRING (array)->size =
-           chars_in_text (XSTRING (array)->data,
-                          STRING_BYTES (XSTRING (array)));
-         clear_string_char_byte_cache ();
-       }
     }
   else
     {