bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10117: duplicate evaluation of after-change-functions hooks in rever


From: Stefan Monnier
Subject: bug#10117: duplicate evaluation of after-change-functions hooks in revert-buffer
Date: Thu, 01 Dec 2011 15:23:29 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

>> change-functions "by hand".  Do you have a small test case reproducing
>> the problem?
> Here is an example:
> First open the attached file in Emacs and evaluate it. Then:
> echo ';Hi!' >>revert-bug.el
> The *Messages* buffer shows the following:
> modify [175, 180[ (old-len=0) [2 times]

Indeed, I see that too.  I've installed the patch below which should
fix it.  Thanks for the simple test case.


        Stefan


=== modified file 'src/fileio.c'
--- src/fileio.c        2011-11-26 21:40:41 +0000
+++ src/fileio.c        2011-12-01 20:14:53 +0000
@@ -4100,6 +4100,16 @@
     adjust_after_insert (PT, PT_BYTE, PT + inserted, PT_BYTE + inserted,
                         inserted);
 
+  /* Call after-change hooks for the inserted text, aside from the case
+     of normal visiting (not with REPLACE), which is done in a new buffer
+     "before" the buffer is changed.  */
+  if (inserted > 0 && total > 0
+      && (NILP (visit) || !NILP (replace)))
+    {
+      signal_after_change (PT, 0, inserted);
+      update_compositions (PT, PT, CHECK_BORDER);
+    }
+
   /* Now INSERTED is measured in characters.  */
 
  handled:
@@ -4270,16 +4280,6 @@
       unbind_to (count1, Qnil);
     }
 
-  /* Call after-change hooks for the inserted text, aside from the case
-     of normal visiting (not with REPLACE), which is done in a new buffer
-     "before" the buffer is changed.  */
-  if (inserted > 0 && total > 0
-      && (NILP (visit) || !NILP (replace)))
-    {
-      signal_after_change (PT, 0, inserted);
-      update_compositions (PT, PT, CHECK_BORDER);
-    }
-
   if (!NILP (visit)
       && current_buffer->modtime == -1)
     {






reply via email to

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