+/* Record a change in property PROP (whose old value was VAL)
+ for LENGTH characters starting at position BEG in BUFFER. */
+
+void
+record_property_change (beg, length, prop, value, buffer)
+ int beg, length;
+ Lisp_Object prop, value, buffer;
+{
+ Lisp_Object lbeg, lend, entry;
+ struct buffer *obuf = current_buffer;
+ int boundary = 0;
+
+ if (EQ (XBUFFER (buffer)->undo_list, Qt))
+ return;
+
+ /* Allocate a cons cell to be the undo boundary after this command. */
+ if (NILP (pending_boundary))
+ pending_boundary = Fcons (Qnil, Qnil);
+
+ if (!EQ (buffer, last_undo_buffer))
+ boundary = 1;
+ last_undo_buffer = buffer;
+
+ /* Switch temporarily to the buffer that was changed. */
+ current_buffer = XBUFFER (buffer);
+
+ if (boundary)
+ Fundo_boundary ();
+
+ if (MODIFF <= SAVE_MODIFF)
+ record_first_change ();
+
+ XSETINT (lbeg, beg);
+ XSETINT (lend, beg + length);
+ entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
+ current_buffer->undo_list = Fcons (entry, current_buffer->undo_list);
+
+ current_buffer = obuf;
+}
+