aboutsummaryrefslogtreecommitdiffstats
path: root/src/undo.c
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-21 03:58:00 +0000
committerRichard M. Stallman1998-03-21 03:58:00 +0000
commite928d437c2a065cb23a37dec3a6a22640d7abfb1 (patch)
tree2b8fa769c0bc2f4ea0e738588809afe745b28911 /src/undo.c
parent628cea90f17ce967f78be99c55ac351b1d939e14 (diff)
downloademacs-e928d437c2a065cb23a37dec3a6a22640d7abfb1.tar.gz
emacs-e928d437c2a065cb23a37dec3a6a22640d7abfb1.zip
(record_delete): Replace LENGTH arg with STRING.
(record_change): Call record_delete the new way.
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/undo.c b/src/undo.c
index fc888381711..af57c4352b1 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -84,13 +84,14 @@ record_insert (beg, length)
84} 84}
85 85
86/* Record that a deletion is about to take place, 86/* Record that a deletion is about to take place,
87 for LENGTH characters at location BEG. */ 87 of the characters in STRING, at location BEG. */
88 88
89void 89void
90record_delete (beg, length) 90record_delete (beg, string)
91 int beg, length; 91 int beg;
92 Lisp_Object string;
92{ 93{
93 Lisp_Object lbeg, lend, sbeg; 94 Lisp_Object sbeg;
94 int at_boundary; 95 int at_boundary;
95 96
96 if (EQ (current_buffer->undo_list, Qt)) 97 if (EQ (current_buffer->undo_list, Qt))
@@ -110,12 +111,10 @@ record_delete (beg, length)
110 if (MODIFF <= SAVE_MODIFF) 111 if (MODIFF <= SAVE_MODIFF)
111 record_first_change (); 112 record_first_change ();
112 113
113 if (PT == beg + length) 114 if (PT == beg + XSTRING (string)->size)
114 XSETINT (sbeg, -beg); 115 XSETINT (sbeg, -beg);
115 else 116 else
116 XSETFASTINT (sbeg, beg); 117 XSETFASTINT (sbeg, beg);
117 XSETFASTINT (lbeg, beg);
118 XSETFASTINT (lend, beg + length);
119 118
120 /* If we are just after an undo boundary, and 119 /* If we are just after an undo boundary, and
121 point wasn't at start of deleted range, record where it was. */ 120 point wasn't at start of deleted range, record where it was. */
@@ -126,8 +125,7 @@ record_delete (beg, length)
126 = Fcons (make_number (last_point_position), current_buffer->undo_list); 125 = Fcons (make_number (last_point_position), current_buffer->undo_list);
127 126
128 current_buffer->undo_list 127 current_buffer->undo_list
129 = Fcons (Fcons (Fbuffer_substring (lbeg, lend), sbeg), 128 = Fcons (Fcons (string, sbeg), current_buffer->undo_list);
130 current_buffer->undo_list);
131} 129}
132 130
133/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 131/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -158,13 +156,13 @@ record_marker_adjustment (marker, adjustment)
158 156
159/* Record that a replacement is about to take place, 157/* Record that a replacement is about to take place,
160 for LENGTH characters at location BEG. 158 for LENGTH characters at location BEG.
161 The replacement does not change the number of characters. */ 159 The replacement must not change the number of characters. */
162 160
163void 161void
164record_change (beg, length) 162record_change (beg, length)
165 int beg, length; 163 int beg, length;
166{ 164{
167 record_delete (beg, length); 165 record_delete (beg, make_buffer_string (beg, beg + length, 1));
168 record_insert (beg, length); 166 record_insert (beg, length);
169} 167}
170 168