diff options
| author | Dmitry Antipov | 2012-08-13 07:39:07 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-13 07:39:07 +0400 |
| commit | 4c31be6153255dfe29a0231253263ea0d9011ac3 (patch) | |
| tree | cfd30617b9270436aad8cdf810a97721aaa20747 /src/undo.c | |
| parent | 1439443be63a2b0d796df8ebca882cdaecb7269f (diff) | |
| download | emacs-4c31be6153255dfe29a0231253263ea0d9011ac3.tar.gz emacs-4c31be6153255dfe29a0231253263ea0d9011ac3.zip | |
Use BSET for write access to Lisp_Object members of struct buffer.
* buffer.h (BSET): New macro.
* buffer.c, casetab.c, cmds.c, coding.c, data.c, editfns.c:
* fileio.c, frame.c, indent.c, insdel.c, intervals.c, keymap.c:
* minibuf.c, print.c, process.c, syntax.c, undo.c, w32fns.c:
* window.c, xdisp.c, xfns.c: Adjust users.
Diffstat (limited to 'src/undo.c')
| -rw-r--r-- | src/undo.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/undo.c b/src/undo.c index c90e7b62405..cfb67ba5bc8 100644 --- a/src/undo.c +++ b/src/undo.c | |||
| @@ -104,8 +104,9 @@ record_point (ptrdiff_t pt) | |||
| 104 | if (at_boundary | 104 | if (at_boundary |
| 105 | && current_buffer == last_boundary_buffer | 105 | && current_buffer == last_boundary_buffer |
| 106 | && last_boundary_position != pt) | 106 | && last_boundary_position != pt) |
| 107 | BVAR (current_buffer, undo_list) | 107 | BSET (current_buffer, undo_list, |
| 108 | = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list)); | 108 | Fcons (make_number (last_boundary_position), |
| 109 | BVAR (current_buffer, undo_list))); | ||
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | /* Record an insertion that just happened or is about to happen, | 112 | /* Record an insertion that just happened or is about to happen, |
| @@ -141,8 +142,8 @@ record_insert (ptrdiff_t beg, ptrdiff_t length) | |||
| 141 | 142 | ||
| 142 | XSETFASTINT (lbeg, beg); | 143 | XSETFASTINT (lbeg, beg); |
| 143 | XSETINT (lend, beg + length); | 144 | XSETINT (lend, beg + length); |
| 144 | BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend), | 145 | BSET (current_buffer, undo_list, |
| 145 | BVAR (current_buffer, undo_list)); | 146 | Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); |
| 146 | } | 147 | } |
| 147 | 148 | ||
| 148 | /* Record that a deletion is about to take place, | 149 | /* Record that a deletion is about to take place, |
| @@ -167,8 +168,8 @@ record_delete (ptrdiff_t beg, Lisp_Object string) | |||
| 167 | record_point (beg); | 168 | record_point (beg); |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | BVAR (current_buffer, undo_list) | 171 | BSET (current_buffer, undo_list, |
| 171 | = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)); | 172 | Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. | 175 | /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. |
| @@ -190,9 +191,9 @@ record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment) | |||
| 190 | Fundo_boundary (); | 191 | Fundo_boundary (); |
| 191 | last_undo_buffer = current_buffer; | 192 | last_undo_buffer = current_buffer; |
| 192 | 193 | ||
| 193 | BVAR (current_buffer, undo_list) | 194 | BSET (current_buffer, undo_list, |
| 194 | = Fcons (Fcons (marker, make_number (adjustment)), | 195 | Fcons (Fcons (marker, make_number (adjustment)), |
| 195 | BVAR (current_buffer, undo_list)); | 196 | BVAR (current_buffer, undo_list))); |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | /* Record that a replacement is about to take place, | 199 | /* Record that a replacement is about to take place, |
| @@ -225,9 +226,9 @@ record_first_change (void) | |||
| 225 | if (base_buffer->base_buffer) | 226 | if (base_buffer->base_buffer) |
| 226 | base_buffer = base_buffer->base_buffer; | 227 | base_buffer = base_buffer->base_buffer; |
| 227 | 228 | ||
| 228 | BVAR (current_buffer, undo_list) = | 229 | BSET (current_buffer, undo_list, |
| 229 | Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), | 230 | Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), |
| 230 | BVAR (current_buffer, undo_list)); | 231 | BVAR (current_buffer, undo_list))); |
| 231 | } | 232 | } |
| 232 | 233 | ||
| 233 | /* Record a change in property PROP (whose old value was VAL) | 234 | /* Record a change in property PROP (whose old value was VAL) |
| @@ -265,7 +266,8 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length, | |||
| 265 | XSETINT (lbeg, beg); | 266 | XSETINT (lbeg, beg); |
| 266 | XSETINT (lend, beg + length); | 267 | XSETINT (lend, beg + length); |
| 267 | entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); | 268 | entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); |
| 268 | BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list)); | 269 | BSET (current_buffer, undo_list, |
| 270 | Fcons (entry, BVAR (current_buffer, undo_list))); | ||
| 269 | 271 | ||
| 270 | current_buffer = obuf; | 272 | current_buffer = obuf; |
| 271 | } | 273 | } |
| @@ -288,11 +290,11 @@ but another undo command will undo to the previous boundary. */) | |||
| 288 | /* If we have preallocated the cons cell to use here, | 290 | /* If we have preallocated the cons cell to use here, |
| 289 | use that one. */ | 291 | use that one. */ |
| 290 | XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); | 292 | XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); |
| 291 | BVAR (current_buffer, undo_list) = pending_boundary; | 293 | BSET (current_buffer, undo_list, pending_boundary); |
| 292 | pending_boundary = Qnil; | 294 | pending_boundary = Qnil; |
| 293 | } | 295 | } |
| 294 | else | 296 | else |
| 295 | BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list)); | 297 | BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list))); |
| 296 | } | 298 | } |
| 297 | last_boundary_position = PT; | 299 | last_boundary_position = PT; |
| 298 | last_boundary_buffer = current_buffer; | 300 | last_boundary_buffer = current_buffer; |
| @@ -433,7 +435,7 @@ truncate_undo_list (struct buffer *b) | |||
| 433 | XSETCDR (last_boundary, Qnil); | 435 | XSETCDR (last_boundary, Qnil); |
| 434 | /* There's nothing we decided to keep, so clear it out. */ | 436 | /* There's nothing we decided to keep, so clear it out. */ |
| 435 | else | 437 | else |
| 436 | BVAR (b, undo_list) = Qnil; | 438 | BSET (b, undo_list, Qnil); |
| 437 | 439 | ||
| 438 | unbind_to (count, Qnil); | 440 | unbind_to (count, Qnil); |
| 439 | } | 441 | } |
| @@ -648,8 +650,8 @@ Return what remains of the list. */) | |||
| 648 | will work right. */ | 650 | will work right. */ |
| 649 | if (did_apply | 651 | if (did_apply |
| 650 | && EQ (oldlist, BVAR (current_buffer, undo_list))) | 652 | && EQ (oldlist, BVAR (current_buffer, undo_list))) |
| 651 | BVAR (current_buffer, undo_list) | 653 | BSET (current_buffer, undo_list, |
| 652 | = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)); | 654 | Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); |
| 653 | 655 | ||
| 654 | UNGCPRO; | 656 | UNGCPRO; |
| 655 | return unbind_to (count, list); | 657 | return unbind_to (count, list); |