emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2b80340: Fix calls to insert-*-hooks when JIT font


From: Eli Zaretskii
Subject: [Emacs-diffs] master 2b80340: Fix calls to insert-*-hooks when JIT font lock is active
Date: Thu, 19 Sep 2019 10:11:03 -0400 (EDT)

branch: master
commit 2b80340bf3585f976d88da94ee9d40eb03230c6b
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix calls to insert-*-hooks when JIT font lock is active
    
    * src/insdel.c (signal_after_change): Save and restore
    interval_insert_behind_hooks and
    interval_insert_in_front_hooks across calls to various other
    hooks, to prevent their clobbering by those other hooks.
    (Bug#37455)
---
 src/buffer.h   |  6 ++++++
 src/insdel.c   | 11 ++++++++++-
 src/textprop.c |  5 ++---
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/buffer.h b/src/buffer.h
index 82d9350..280d4e9 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1139,6 +1139,12 @@ extern struct buffer buffer_local_flags;
    that don't have such names.  */
 
 extern struct buffer buffer_local_symbols;
+
+/* verify_interval_modification saves insertion hooks here
+   to be run later by report_interval_modification.  */
+extern Lisp_Object interval_insert_behind_hooks;
+extern Lisp_Object interval_insert_in_front_hooks;
+
 
 extern void delete_all_overlays (struct buffer *);
 extern void reset_buffer (struct buffer *);
diff --git a/src/insdel.c b/src/insdel.c
index 1da8d55..093b841 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2201,7 +2201,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;
+  Lisp_Object tmp, save_insert_behind_hooks, save_insert_in_from_hooks;
 
   if (inhibit_modification_hooks)
     return;
@@ -2237,6 +2237,12 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t 
lendel, ptrdiff_t lenins)
       return;
     }
 
+  /* Save and restore the insert-*-hooks, because other hooks like
+     after-change-functions, called below, could clobber them if they
+     manipulate text properties.  */
+  save_insert_behind_hooks = interval_insert_behind_hooks;
+  save_insert_in_from_hooks = interval_insert_in_front_hooks;
+
   if (!NILP (combine_after_change_list))
     Fcombine_after_change_execute ();
 
@@ -2259,6 +2265,9 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, 
ptrdiff_t lenins)
       rvoe_arg.errorp = 0;
     }
 
+  interval_insert_behind_hooks = save_insert_behind_hooks;
+  interval_insert_in_front_hooks = save_insert_in_from_hooks;
+
   if (buffer_has_overlays ())
     report_overlay_modification (make_fixnum (charpos),
                                 make_fixnum (charpos + lenins),
diff --git a/src/textprop.c b/src/textprop.c
index 44c3332..d36b9e1 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -58,9 +58,8 @@ enum property_set_type
 
 /* verify_interval_modification saves insertion hooks here
    to be run later by report_interval_modification.  */
-static Lisp_Object interval_insert_behind_hooks;
-static Lisp_Object interval_insert_in_front_hooks;
-
+Lisp_Object interval_insert_behind_hooks;
+Lisp_Object interval_insert_in_front_hooks;
 
 /* Signal a `text-read-only' error.  This function makes it easier
    to capture that error in GDB by putting a breakpoint on it.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]