Mercurial > emacs
comparison src/undo.c @ 7395:99e9c133a752
(record_delete): Record the old point value only right after a boundary.
(record_delete): Test last_point_position_buffer.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 07 May 1994 08:38:28 +0000 |
parents | cd81dba38a49 |
children | 31d444fcae24 |
comparison
equal
deleted
inserted
replaced
7394:6106d22ab2ca | 7395:99e9c133a752 |
---|---|
87 | 87 |
88 record_delete (beg, length) | 88 record_delete (beg, length) |
89 int beg, length; | 89 int beg, length; |
90 { | 90 { |
91 Lisp_Object lbeg, lend, sbeg; | 91 Lisp_Object lbeg, lend, sbeg; |
92 int at_boundary; | |
92 | 93 |
93 if (EQ (current_buffer->undo_list, Qt)) | 94 if (EQ (current_buffer->undo_list, Qt)) |
94 return; | 95 return; |
95 | 96 |
96 /* Allocate a cons cell to be the undo boundary after this command. */ | 97 /* Allocate a cons cell to be the undo boundary after this command. */ |
98 pending_boundary = Fcons (Qnil, Qnil); | 99 pending_boundary = Fcons (Qnil, Qnil); |
99 | 100 |
100 if (current_buffer != XBUFFER (last_undo_buffer)) | 101 if (current_buffer != XBUFFER (last_undo_buffer)) |
101 Fundo_boundary (); | 102 Fundo_boundary (); |
102 XSET (last_undo_buffer, Lisp_Buffer, current_buffer); | 103 XSET (last_undo_buffer, Lisp_Buffer, current_buffer); |
104 | |
105 at_boundary = (CONSP (current_buffer->undo_list) | |
106 && NILP (XCONS (current_buffer->undo_list)->car)); | |
103 | 107 |
104 if (MODIFF <= current_buffer->save_modified) | 108 if (MODIFF <= current_buffer->save_modified) |
105 record_first_change (); | 109 record_first_change (); |
106 | 110 |
107 if (point == beg + length) | 111 if (point == beg + length) |
109 else | 113 else |
110 XFASTINT (sbeg) = beg; | 114 XFASTINT (sbeg) = beg; |
111 XFASTINT (lbeg) = beg; | 115 XFASTINT (lbeg) = beg; |
112 XFASTINT (lend) = beg + length; | 116 XFASTINT (lend) = beg + length; |
113 | 117 |
114 /* If point wasn't at start of deleted range, record where it was. */ | 118 /* If we are just after an undo boundary, and |
115 if (last_point_position != XFASTINT (sbeg)) | 119 point wasn't at start of deleted range, record where it was. */ |
120 if (at_boundary | |
121 && last_point_position != XFASTINT (sbeg) | |
122 && current_buffer == XBUFFER (last_point_position_buffer)) | |
116 current_buffer->undo_list | 123 current_buffer->undo_list |
117 = Fcons (make_number (last_point_position), current_buffer->undo_list); | 124 = Fcons (make_number (last_point_position), current_buffer->undo_list); |
118 | 125 |
119 current_buffer->undo_list | 126 current_buffer->undo_list |
120 = Fcons (Fcons (Fbuffer_substring (lbeg, lend), sbeg), | 127 = Fcons (Fcons (Fbuffer_substring (lbeg, lend), sbeg), |