diff options
| author | Phillip Lord | 2015-11-25 21:39:49 +0000 |
|---|---|---|
| committer | Phillip Lord | 2015-11-25 21:39:49 +0000 |
| commit | 957b05c615ee749b569d9fa2b214b2a2d8fa9bda (patch) | |
| tree | 132afd0ca9d54409e43b96cdec21b9b96852990f /src | |
| parent | 8f2a5a8aa487036006b7590c896cde30157ca7e0 (diff) | |
| download | emacs-957b05c615ee749b569d9fa2b214b2a2d8fa9bda.tar.gz emacs-957b05c615ee749b569d9fa2b214b2a2d8fa9bda.zip | |
run_undoable_changes now called from insdel.
The original calls from inside undo.c are not always at a safe position
to call lisp, as they originate in varied positions within insdel.c.
Calling them directly from prepare_to_modify_buffer_1 ensures that they
are always run at the same point.
* undo.c (run_undoable_changes,syms_of_undo): Remove function
and symbol used.
* insdel.c (run_undoable_changes): Add function and symbol.
Diffstat (limited to 'src')
| -rw-r--r-- | src/insdel.c | 16 | ||||
| -rw-r--r-- | src/undo.c | 19 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/insdel.c b/src/insdel.c index 24807b1e8f4..8b08c1e59b7 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1765,6 +1765,18 @@ modify_text (ptrdiff_t start, ptrdiff_t end) | |||
| 1765 | bset_point_before_scroll (current_buffer, Qnil); | 1765 | bset_point_before_scroll (current_buffer, Qnil); |
| 1766 | } | 1766 | } |
| 1767 | 1767 | ||
| 1768 | /* Signal that we are about to make a change that may result in new | ||
| 1769 | undo information. | ||
| 1770 | */ | ||
| 1771 | static void | ||
| 1772 | run_undoable_change (void) | ||
| 1773 | { | ||
| 1774 | if (EQ (BVAR (current_buffer, undo_list), Qt)) | ||
| 1775 | return; | ||
| 1776 | |||
| 1777 | call0 (Qundo_auto__undoable_change); | ||
| 1778 | } | ||
| 1779 | |||
| 1768 | /* Check that it is okay to modify the buffer between START and END, | 1780 | /* Check that it is okay to modify the buffer between START and END, |
| 1769 | which are char positions. | 1781 | which are char positions. |
| 1770 | 1782 | ||
| @@ -1786,6 +1798,8 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, | |||
| 1786 | if (!NILP (BVAR (current_buffer, read_only))) | 1798 | if (!NILP (BVAR (current_buffer, read_only))) |
| 1787 | Fbarf_if_buffer_read_only (temp); | 1799 | Fbarf_if_buffer_read_only (temp); |
| 1788 | 1800 | ||
| 1801 | run_undoable_change(); | ||
| 1802 | |||
| 1789 | bset_redisplay (current_buffer); | 1803 | bset_redisplay (current_buffer); |
| 1790 | 1804 | ||
| 1791 | if (buffer_intervals (current_buffer)) | 1805 | if (buffer_intervals (current_buffer)) |
| @@ -2187,6 +2201,8 @@ syms_of_insdel (void) | |||
| 2187 | combine_after_change_list = Qnil; | 2201 | combine_after_change_list = Qnil; |
| 2188 | combine_after_change_buffer = Qnil; | 2202 | combine_after_change_buffer = Qnil; |
| 2189 | 2203 | ||
| 2204 | DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); | ||
| 2205 | |||
| 2190 | DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, | 2206 | DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, |
| 2191 | doc: /* Used internally by the function `combine-after-change-calls' macro. */); | 2207 | doc: /* Used internally by the function `combine-after-change-calls' macro. */); |
| 2192 | Vcombine_after_change_calls = Qnil; | 2208 | Vcombine_after_change_calls = Qnil; |
diff --git a/src/undo.c b/src/undo.c index 214beaeb9ea..104c3bb3fc4 100644 --- a/src/undo.c +++ b/src/undo.c | |||
| @@ -34,12 +34,6 @@ static ptrdiff_t last_boundary_position; | |||
| 34 | an undo-boundary. */ | 34 | an undo-boundary. */ |
| 35 | static Lisp_Object pending_boundary; | 35 | static Lisp_Object pending_boundary; |
| 36 | 36 | ||
| 37 | static void | ||
| 38 | run_undoable_change (void) | ||
| 39 | { | ||
| 40 | call0 (Qundo_auto__undoable_change); | ||
| 41 | } | ||
| 42 | |||
| 43 | /* Record point as it was at beginning of this command (if necessary) | 37 | /* Record point as it was at beginning of this command (if necessary) |
| 44 | and prepare the undo info for recording a change. | 38 | and prepare the undo info for recording a change. |
| 45 | PT is the position of point that will naturally occur as a result of the | 39 | PT is the position of point that will naturally occur as a result of the |
| @@ -58,8 +52,6 @@ record_point (ptrdiff_t pt) | |||
| 58 | if (NILP (pending_boundary)) | 52 | if (NILP (pending_boundary)) |
| 59 | pending_boundary = Fcons (Qnil, Qnil); | 53 | pending_boundary = Fcons (Qnil, Qnil); |
| 60 | 54 | ||
| 61 | run_undoable_change (); | ||
| 62 | |||
| 63 | at_boundary = ! CONSP (BVAR (current_buffer, undo_list)) | 55 | at_boundary = ! CONSP (BVAR (current_buffer, undo_list)) |
| 64 | || NILP (XCAR (BVAR (current_buffer, undo_list))); | 56 | || NILP (XCAR (BVAR (current_buffer, undo_list))); |
| 65 | 57 | ||
| @@ -130,8 +122,6 @@ record_marker_adjustments (ptrdiff_t from, ptrdiff_t to) | |||
| 130 | if (NILP (pending_boundary)) | 122 | if (NILP (pending_boundary)) |
| 131 | pending_boundary = Fcons (Qnil, Qnil); | 123 | pending_boundary = Fcons (Qnil, Qnil); |
| 132 | 124 | ||
| 133 | run_undoable_change (); | ||
| 134 | |||
| 135 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) | 125 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) |
| 136 | { | 126 | { |
| 137 | charpos = m->charpos; | 127 | charpos = m->charpos; |
| @@ -243,11 +233,6 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length, | |||
| 243 | if (NILP (pending_boundary)) | 233 | if (NILP (pending_boundary)) |
| 244 | pending_boundary = Fcons (Qnil, Qnil); | 234 | pending_boundary = Fcons (Qnil, Qnil); |
| 245 | 235 | ||
| 246 | /* Switch temporarily to the buffer that was changed. */ | ||
| 247 | set_buffer_internal (buf); | ||
| 248 | |||
| 249 | run_undoable_change (); | ||
| 250 | |||
| 251 | if (MODIFF <= SAVE_MODIFF) | 236 | if (MODIFF <= SAVE_MODIFF) |
| 252 | record_first_change (); | 237 | record_first_change (); |
| 253 | 238 | ||
| @@ -256,9 +241,6 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length, | |||
| 256 | entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); | 241 | entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); |
| 257 | bset_undo_list (current_buffer, | 242 | bset_undo_list (current_buffer, |
| 258 | Fcons (entry, BVAR (current_buffer, undo_list))); | 243 | Fcons (entry, BVAR (current_buffer, undo_list))); |
| 259 | |||
| 260 | /* Reset the buffer */ | ||
| 261 | set_buffer_internal (obuf); | ||
| 262 | } | 244 | } |
| 263 | 245 | ||
| 264 | DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0, | 246 | DEFUN ("undo-boundary", Fundo_boundary, Sundo_boundary, 0, 0, 0, |
| @@ -432,7 +414,6 @@ void | |||
| 432 | syms_of_undo (void) | 414 | syms_of_undo (void) |
| 433 | { | 415 | { |
| 434 | DEFSYM (Qinhibit_read_only, "inhibit-read-only"); | 416 | DEFSYM (Qinhibit_read_only, "inhibit-read-only"); |
| 435 | DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); | ||
| 436 | DEFSYM (Qundo_auto__last_boundary_cause, "undo-auto--last-boundary-cause"); | 417 | DEFSYM (Qundo_auto__last_boundary_cause, "undo-auto--last-boundary-cause"); |
| 437 | DEFSYM (Qexplicit, "explicit"); | 418 | DEFSYM (Qexplicit, "explicit"); |
| 438 | 419 | ||