aboutsummaryrefslogtreecommitdiffstats
path: root/src/undo.c
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-01 09:01:13 +0000
committerRichard M. Stallman1993-03-01 09:01:13 +0000
commitda9319d540efcdb6117a5cc9f4550dc6205170b0 (patch)
tree054bf11cfe4f3c4c201b03d53b8148e42d733918 /src/undo.c
parent7651e1f53fcfd40574ff1c23cb99b4579021e8cc (diff)
downloademacs-da9319d540efcdb6117a5cc9f4550dc6205170b0.tar.gz
emacs-da9319d540efcdb6117a5cc9f4550dc6205170b0.zip
(record_property_change): Typo in last change.
(Fprimitive_undo): Handle property-change undo entry. (record_property_change): New function.
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/undo.c b/src/undo.c
index eed355e5b10..d004410a71e 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -124,6 +124,41 @@ record_first_change ()
124 current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list); 124 current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list);
125} 125}
126 126
127/* Record a change in property PROP (whose old value was VAL)
128 for LENGTH characters starting at position BEG in BUFFER. */
129
130record_property_change (beg, length, prop, value, buffer)
131 int beg, length;
132 Lisp_Object prop, value, buffer;
133{
134 Lisp_Object lbeg, lend, entry;
135 struct buffer *obuf = current_buffer;
136 int boundary = 0;
137
138 if (!EQ (buffer, last_undo_buffer))
139 boundary = 1;
140 last_undo_buffer = buffer;
141
142 if (EQ (current_buffer->undo_list, Qt))
143 return;
144
145 /* Switch temporarily to the buffer that was changed. */
146 current_buffer = XBUFFER (buffer);
147
148 if (boundary)
149 Fundo_boundary ();
150
151 if (MODIFF <= current_buffer->save_modified)
152 record_first_change ();
153
154 XSET (lbeg, Lisp_Int, beg);
155 XSET (lend, Lisp_Int, beg + length);
156 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
157 current_buffer->undo_list = Fcons (entry, current_buffer->undo_list);
158
159 current_buffer = obuf;
160}
161
127DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0, 162DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0,
128 "Mark a boundary between units of undo.\n\ 163 "Mark a boundary between units of undo.\n\
129An undo command will stop at this point,\n\ 164An undo command will stop at this point,\n\
@@ -299,6 +334,20 @@ Return what remains of the list.")
299#endif /* CLASH_DETECTION */ 334#endif /* CLASH_DETECTION */
300 Fset_buffer_modified_p (Qnil); 335 Fset_buffer_modified_p (Qnil);
301 } 336 }
337 if (EQ (car, Qnil))
338 {
339 /* Element (t prop val beg . end) records property change. */
340 Lisp_Object beg, end, prop, val;
341
342 prop = Fcar (cdr);
343 cdr = Fcdr (cdr);
344 val = Fcar (cdr);
345 cdr = Fcdr (cdr);
346 beg = Fcar (cdr);
347 end = Fcdr (cdr);
348
349 Fput_text_property (beg, end, prop, val, Qnil);
350 }
302 else if (XTYPE (car) == Lisp_Int && XTYPE (cdr) == Lisp_Int) 351 else if (XTYPE (car) == Lisp_Int && XTYPE (cdr) == Lisp_Int)
303 { 352 {
304 /* Element (BEG . END) means range was inserted. */ 353 /* Element (BEG . END) means range was inserted. */