]> git.eshelyaron.com Git - emacs.git/commitdiff
Make combine-after-change-calls work in the common case again
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 May 2019 18:58:20 +0000 (14:58 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 6 May 2019 18:58:20 +0000 (14:58 -0400)
* 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

index 1231bb2682bb9102b57035ae91c2724f3c3634b1..85fffd8fd16d67136eab5fecb25a4d6d435e4968 100644 (file)
@@ -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.  */);