diff options
author | Phillip Lord <phillip.lord@russet.org.uk> | 2015-11-17 19:02:24 +0000 |
---|---|---|
committer | Phillip Lord <phillip.lord@russet.org.uk> | 2015-11-17 20:33:38 +0000 |
commit | 01644fe5d4c463612d479384b9404e45558aff1d (patch) | |
tree | 15718410556592eaf5ca1967a05451310b54b446 /src/insdel.c | |
parent | 5f7a2a90536557e3dcb3bb64d4bbbd49ea7b3fee (diff) | |
download | emacs-fix/segfault-undoable-change-prepare-for-buffer.tar.gz |
run_undoable_changes now called from insdel.fix/segfault-undoable-change-prepare-for-buffer
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.
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/insdel.c b/src/insdel.c index 24807b1e8f4..0b1b0c234d3 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "window.h" #include "region-cache.h" + static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool, bool); static void insert_from_buffer_1 (struct buffer *, ptrdiff_t, ptrdiff_t, bool); @@ -1765,6 +1766,15 @@ modify_text (ptrdiff_t start, ptrdiff_t end) bset_point_before_scroll (current_buffer, Qnil); } +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. @@ -1786,6 +1796,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 +2199,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; |