From c31823a51bba1e4f0c87af1a08ce856cc600f5c8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 6 May 2019 14:58:20 -0400 Subject: [PATCH] Make combine-after-change-calls work in the common case again * src/insdel.c (signal_after_change): Allow combine_after_change_calls even when syntax-ppss-flush-cache is on before-change-functions. --- src/insdel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/insdel.c b/src/insdel.c index 1231bb2682b..85fffd8fd16 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -2178,6 +2178,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) { ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; + Lisp_Object tmp; if (inhibit_modification_hooks) return; @@ -2186,7 +2187,16 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) and there are no before-change functions, just record the args that we were going to use. */ if (! NILP (Vcombine_after_change_calls) - && NILP (Vbefore_change_functions) + /* It's OK to defer after-changes even if syntax-ppss-flush-cache + * is on before-change-functions, which is common enough to be worth + * adding a special case for it. */ + && (NILP (Vbefore_change_functions) + || (CONSP (Vbefore_change_functions) + && EQ (Qt, XCAR (Vbefore_change_functions)) + && NILP (Fdefault_value (Qbefore_change_functions)) + && CONSP (tmp = XCDR (Vbefore_change_functions)) + && NILP (XCDR (tmp)) + && EQ (XCAR (tmp), Qsyntax_ppss_flush_cache))) && !buffer_has_overlays ()) { Lisp_Object elt; @@ -2343,6 +2353,7 @@ syms_of_insdel (void) combine_after_change_buffer = Qnil; DEFSYM (Qundo_auto__undoable_change, "undo-auto--undoable-change"); + DEFSYM (Qsyntax_ppss_flush_cache, "syntax-ppss-flush-cache"); DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, doc: /* Used internally by the function `combine-after-change-calls' macro. */); -- 2.39.2