GNU bug report logs - #10117
duplicate evaluation of after-change-functions hooks in revert-buffer

Previous Next

Package: emacs;

Reported by: Tiphaine Turpin <tiphaine.turpin <at> inria.fr>

Date: Wed, 23 Nov 2011 11:21:02 UTC

Severity: normal

Tags: moreinfo

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 10117-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Tiphaine Turpin <tiphaine.turpin <at> inria.fr>
Cc: 10117-done <at> debbugs.gnu.org
Subject: Re: bug#10117: duplicate evaluation of after-change-functions hooks in
	revert-buffer
Date: Thu, 01 Dec 2011 15:23:29 -0500
>> 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)
     {





This bug report was last modified 13 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.