diff options
author | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:39:08 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:39:08 -0800 |
commit | ec0a80cc283badc7f7fd5ef78512dde6d34b1355 (patch) | |
tree | 7190e0fb3d4aa06018d8cf997f06b806fb09a9c8 /src/insdel.c | |
parent | d259328fb87db8cc67d52771efcfa653e52c5b71 (diff) | |
parent | e823c34072bf045800d91e12c7ddb61fa23c6e30 (diff) | |
download | emacs-25-merge.tar.gz |
Merge emacs-25 into master (using imerge)emacs-25-merge
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/insdel.c b/src/insdel.c index 24807b1e8f4..bb3171b14ce 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1765,6 +1765,18 @@ modify_text (ptrdiff_t start, ptrdiff_t end) bset_point_before_scroll (current_buffer, Qnil); } +/* Signal that we are about to make a change that may result in new + undo information. + */ +static void +run_undoable_change (void) +{ + if (EQ (BVAR (current_buffer, undo_list), Qt)) + return; + + call0 (Qundo_auto__undoable_change); +} + /* Check that it is okay to modify the buffer between START and END, which are char positions. @@ -1773,7 +1785,12 @@ modify_text (ptrdiff_t start, ptrdiff_t end) any modification properties the text may have. If PRESERVE_PTR is nonzero, we relocate *PRESERVE_PTR - by holding its value temporarily in a marker. */ + by holding its value temporarily in a marker. + + This function runs Lisp, which means it can GC, which means it can + compact buffers, including the current buffer being worked on here. + So don't you dare calling this function while manipulating the gap, + or during some other similar "critical section". */ void prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, @@ -1786,6 +1803,8 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, if (!NILP (BVAR (current_buffer, read_only))) Fbarf_if_buffer_read_only (temp); + run_undoable_change(); + bset_redisplay (current_buffer); if (buffer_intervals (current_buffer)) @@ -2187,6 +2206,8 @@ syms_of_insdel (void) combine_after_change_list = Qnil; combine_after_change_buffer = Qnil; + DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); + DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the function `combine-after-change-calls' macro. */); Vcombine_after_change_calls = Qnil; |