aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1993-03-01 09:01:13 +0000
committerRichard M. Stallman <[email protected]>1993-03-01 09:01:13 +0000
commitda9319d540efcdb6117a5cc9f4550dc6205170b0 (patch)
tree054bf11cfe4f3c4c201b03d53b8148e42d733918 /src
parent7651e1f53fcfd40574ff1c23cb99b4579021e8cc (diff)
(record_property_change): Typo in last change.
(Fprimitive_undo): Handle property-change undo entry. (record_property_change): New function.
Diffstat (limited to 'src')
-rw-r--r--src/undo.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/undo.c b/src/undo.c
index eed355e5b1..d004410a71 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -124,6 +124,41 @@ record_first_change ()
current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list);
}
+/* Record a change in property PROP (whose old value was VAL)
+ for LENGTH characters starting at position BEG in BUFFER. */
+
+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 (buffer, last_undo_buffer))
+ boundary = 1;
+ last_undo_buffer = buffer;
+
+ if (EQ (current_buffer->undo_list, Qt))
+ return;
+
+ /* Switch temporarily to the buffer that was changed. */
+ current_buffer = XBUFFER (buffer);
+
+ if (boundary)
+ Fundo_boundary ();
+
+ if (MODIFF <= current_buffer->save_modified)
+ record_first_change ();
+
+ XSET (lbeg, Lisp_Int, beg);
+ XSET (lend, Lisp_Int, 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;
+}
+
DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0,
"Mark a boundary between units of undo.\n\
An undo command will stop at this point,\n\
@@ -299,6 +334,20 @@ Return what remains of the list.")
#endif /* CLASH_DETECTION */
Fset_buffer_modified_p (Qnil);
}
+ if (EQ (car, Qnil))
+ {
+ /* Element (t prop val beg . end) records property change. */
+ Lisp_Object beg, end, prop, val;
+
+ prop = Fcar (cdr);
+ cdr = Fcdr (cdr);
+ val = Fcar (cdr);
+ cdr = Fcdr (cdr);
+ beg = Fcar (cdr);
+ end = Fcdr (cdr);
+
+ Fput_text_property (beg, end, prop, val, Qnil);
+ }
else if (XTYPE (car) == Lisp_Int && XTYPE (cdr) == Lisp_Int)
{
/* Element (BEG . END) means range was inserted. */