Mercurial > emacs
comparison src/undo.c @ 110484:7ca55779eeef
Fix some more uses of int instead of EMACS_INT.
editfns.c (Fsubst_char_in_region, Ftranslate_region_internal)
(check_translation): Use EMACS_INT for buffer positions and
length.
undo.c (record_marker_adjustment, record_delete)
(record_change, record_point, record_insert)
(record_property_change, Fprimitive_undo): Use EMACS_INT for
buffer positions.
lisp.h (record_marker_adjustment, record_delete)
(record_change, record_point, record_insert)
(record_property_change, Fprimitive_undo): Adjust prototypes.
| author | Eli Zaretskii <eliz@gnu.org> |
|---|---|
| date | Wed, 22 Sep 2010 15:22:06 -0400 |
| parents | 8cfee7d2955f |
| children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
| 110483:2892adf3a65b | 110484:7ca55779eeef |
|---|---|
| 65 and prepare the undo info for recording a change. | 65 and prepare the undo info for recording a change. |
| 66 PT is the position of point that will naturally occur as a result of the | 66 PT is the position of point that will naturally occur as a result of the |
| 67 undo record that will be added just after this command terminates. */ | 67 undo record that will be added just after this command terminates. */ |
| 68 | 68 |
| 69 static void | 69 static void |
| 70 record_point (int pt) | 70 record_point (EMACS_INT pt) |
| 71 { | 71 { |
| 72 int at_boundary; | 72 int at_boundary; |
| 73 | 73 |
| 74 /* Don't record position of pt when undo_inhibit_record_point holds. */ | 74 /* Don't record position of pt when undo_inhibit_record_point holds. */ |
| 75 if (undo_inhibit_record_point) | 75 if (undo_inhibit_record_point) |
| 127 for LENGTH characters at position BEG. | 127 for LENGTH characters at position BEG. |
| 128 (It is possible to record an insertion before or after the fact | 128 (It is possible to record an insertion before or after the fact |
| 129 because we don't need to record the contents.) */ | 129 because we don't need to record the contents.) */ |
| 130 | 130 |
| 131 void | 131 void |
| 132 record_insert (int beg, int length) | 132 record_insert (EMACS_INT beg, EMACS_INT length) |
| 133 { | 133 { |
| 134 Lisp_Object lbeg, lend; | 134 Lisp_Object lbeg, lend; |
| 135 | 135 |
| 136 if (EQ (current_buffer->undo_list, Qt)) | 136 if (EQ (current_buffer->undo_list, Qt)) |
| 137 return; | 137 return; |
| 162 | 162 |
| 163 /* Record that a deletion is about to take place, | 163 /* Record that a deletion is about to take place, |
| 164 of the characters in STRING, at location BEG. */ | 164 of the characters in STRING, at location BEG. */ |
| 165 | 165 |
| 166 void | 166 void |
| 167 record_delete (int beg, Lisp_Object string) | 167 record_delete (EMACS_INT beg, Lisp_Object string) |
| 168 { | 168 { |
| 169 Lisp_Object sbeg; | 169 Lisp_Object sbeg; |
| 170 | 170 |
| 171 if (EQ (current_buffer->undo_list, Qt)) | 171 if (EQ (current_buffer->undo_list, Qt)) |
| 172 return; | 172 return; |
| 190 This is done only when a marker points within text being deleted, | 190 This is done only when a marker points within text being deleted, |
| 191 because that's the only case where an automatic marker adjustment | 191 because that's the only case where an automatic marker adjustment |
| 192 won't be inverted automatically by undoing the buffer modification. */ | 192 won't be inverted automatically by undoing the buffer modification. */ |
| 193 | 193 |
| 194 void | 194 void |
| 195 record_marker_adjustment (Lisp_Object marker, int adjustment) | 195 record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) |
| 196 { | 196 { |
| 197 if (EQ (current_buffer->undo_list, Qt)) | 197 if (EQ (current_buffer->undo_list, Qt)) |
| 198 return; | 198 return; |
| 199 | 199 |
| 200 /* Allocate a cons cell to be the undo boundary after this command. */ | 200 /* Allocate a cons cell to be the undo boundary after this command. */ |
| 213 /* Record that a replacement is about to take place, | 213 /* Record that a replacement is about to take place, |
| 214 for LENGTH characters at location BEG. | 214 for LENGTH characters at location BEG. |
| 215 The replacement must not change the number of characters. */ | 215 The replacement must not change the number of characters. */ |
| 216 | 216 |
| 217 void | 217 void |
| 218 record_change (int beg, int length) | 218 record_change (EMACS_INT beg, EMACS_INT length) |
| 219 { | 219 { |
| 220 record_delete (beg, make_buffer_string (beg, beg + length, 1)); | 220 record_delete (beg, make_buffer_string (beg, beg + length, 1)); |
| 221 record_insert (beg, length); | 221 record_insert (beg, length); |
| 222 } | 222 } |
| 223 | 223 |
| 248 | 248 |
| 249 /* Record a change in property PROP (whose old value was VAL) | 249 /* Record a change in property PROP (whose old value was VAL) |
| 250 for LENGTH characters starting at position BEG in BUFFER. */ | 250 for LENGTH characters starting at position BEG in BUFFER. */ |
| 251 | 251 |
| 252 void | 252 void |
| 253 record_property_change (int beg, int length, Lisp_Object prop, Lisp_Object value, Lisp_Object buffer) | 253 record_property_change (EMACS_INT beg, EMACS_INT length, |
| 254 Lisp_Object prop, Lisp_Object value, | |
| 255 Lisp_Object buffer) | |
| 254 { | 256 { |
| 255 Lisp_Object lbeg, lend, entry; | 257 Lisp_Object lbeg, lend, entry; |
| 256 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); | 258 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); |
| 257 int boundary = 0; | 259 int boundary = 0; |
| 258 | 260 |
| 599 } | 601 } |
| 600 else if (STRINGP (car) && INTEGERP (cdr)) | 602 else if (STRINGP (car) && INTEGERP (cdr)) |
| 601 { | 603 { |
| 602 /* Element (STRING . POS) means STRING was deleted. */ | 604 /* Element (STRING . POS) means STRING was deleted. */ |
| 603 Lisp_Object membuf; | 605 Lisp_Object membuf; |
| 604 int pos = XINT (cdr); | 606 EMACS_INT pos = XINT (cdr); |
| 605 | 607 |
| 606 membuf = car; | 608 membuf = car; |
| 607 if (pos < 0) | 609 if (pos < 0) |
| 608 { | 610 { |
| 609 if (-pos < BEGV || -pos > ZV) | 611 if (-pos < BEGV || -pos > ZV) |
