]> code.delx.au - gnu-emacs/blobdiff - src/textprop.c
(Fintern_soft): Accept a symbol argument.
[gnu-emacs] / src / textprop.c
index 14cebd69d6438bfe63254c1cc46ce2ddc12b2025..8b405a2bb44b5cd36a7deb7daaee17b27b702dc9 100644 (file)
@@ -46,8 +46,6 @@ Boston, MA 02111-1307, USA.  */
   necessary for the system to remain consistent.  This requirement
   is enforced by the subrs installing properties onto the intervals.  */
 
-/* The rest of the file is within this conditional */
-#ifdef USE_TEXT_PROPERTIES
 \f
 /* Types of hooks.  */
 Lisp_Object Qmouse_left;
@@ -1088,6 +1086,21 @@ The optional fourth argument, OBJECT,\n\
 is the string or buffer containing the text.")
   (start, end, properties, object)
      Lisp_Object start, end, properties, object;
+{
+  return set_text_properties (start, end, properties, object, Qt);
+}
+
+
+/* Replace properties of text from START to END with new list of
+   properties PROPERTIES.  OBJECT is the buffer or string containing
+   the text.  OBJECT nil means use the current buffer.
+   SIGNAL_AFTER_CHANGE_P nil means don't signal after changes.  Value
+   is non-nil if properties were replaced; it is nil if there weren't
+   any properties to replace.  */
+
+Lisp_Object
+set_text_properties (start, end, properties, object, signal_after_change_p)
+     Lisp_Object start, end, properties, object, signal_after_change_p;
 {
   register INTERVAL i, unchanged;
   register INTERVAL prev_changed = NULL_INTERVAL;
@@ -1150,7 +1163,7 @@ is the string or buffer containing the text.")
          copy_properties (unchanged, i);
          i = split_interval_left (i, len);
          set_properties (properties, i, object);
-         if (BUFFERP (object))
+         if (BUFFERP (object) && !NILP (signal_after_change_p))
            signal_after_change (XINT (start), XINT (end) - XINT (start),
                                 XINT (end) - XINT (start));
 
@@ -1161,7 +1174,7 @@ is the string or buffer containing the text.")
 
       if (LENGTH (i) == len)
        {
-         if (BUFFERP (object))
+         if (BUFFERP (object) && !NILP (signal_after_change_p))
            signal_after_change (XINT (start), XINT (end) - XINT (start),
                                 XINT (end) - XINT (start));
 
@@ -1190,7 +1203,7 @@ is the string or buffer containing the text.")
          set_properties (properties, i, object);
          if (!NULL_INTERVAL_P (prev_changed))
            merge_interval_left (i);
-         if (BUFFERP (object))
+         if (BUFFERP (object) && !NILP (signal_after_change_p))
            signal_after_change (XINT (start), XINT (end) - XINT (start),
                                 XINT (end) - XINT (start));
          return Qt;
@@ -1210,7 +1223,7 @@ is the string or buffer containing the text.")
       i = next_interval (i);
     }
 
-  if (BUFFERP (object))
+  if (BUFFERP (object) && !NILP (signal_after_change_p))
     signal_after_change (XINT (start), XINT (end) - XINT (start),
                         XINT (end) - XINT (start));
   return Qt;
@@ -1693,7 +1706,7 @@ verify_interval_modification (buf, start, end)
                      if (TMEM (Qread_only, tem)
                          || (NILP (Fplist_get (i->plist, Qread_only))
                              && TMEM (Qcategory, tem)))
-                       error ("Attempt to insert within read-only text");
+                       Fsignal (Qtext_read_only, Qnil);
                    }
                }
 
@@ -1713,7 +1726,7 @@ verify_interval_modification (buf, start, end)
                      if (! TMEM (Qread_only, tem)
                          && (! NILP (Fplist_get (prev->plist,Qread_only))
                              || ! TMEM (Qcategory, tem)))
-                       error ("Attempt to insert within read-only text");
+                       Fsignal (Qtext_read_only, Qnil);
                    }
                }
            }
@@ -1732,13 +1745,13 @@ verify_interval_modification (buf, start, end)
                  if (TMEM (Qread_only, tem)
                      || (NILP (Fplist_get (i->plist, Qread_only))
                          && TMEM (Qcategory, tem)))
-                   error ("Attempt to insert within read-only text");
+                   Fsignal (Qtext_read_only, Qnil);
 
                  tem = textget (prev->plist, Qrear_nonsticky);
                  if (! TMEM (Qread_only, tem)
                      && (! NILP (Fplist_get (prev->plist, Qread_only))
                          || ! TMEM (Qcategory, tem)))
-                   error ("Attempt to insert within read-only text");
+                   Fsignal (Qtext_read_only, Qnil);
                }
            }
        }
@@ -1760,7 +1773,7 @@ verify_interval_modification (buf, start, end)
       do
        {
          if (! INTERVAL_WRITABLE_P (i))
-           error ("Attempt to modify read-only text");
+           Fsignal (Qtext_read_only, Qnil);
 
          mod_hooks = textget (i->plist, Qmodification_hooks);
          if (! NILP (mod_hooks) && ! EQ (mod_hooks, prev_mod_hooks))
@@ -1882,8 +1895,3 @@ This also inhibits the use of the `intangible' text property.");
 /*  defsubr (&Scopy_text_properties); */
 }
 
-#else
-
-lose -- this shouldn't be compiled if USE_TEXT_PROPERTIES isn't defined
-
-#endif /* USE_TEXT_PROPERTIES */