unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Tiphaine Turpin <tiphaine.turpin@inria.fr>
Cc: 10117-done@debbugs.gnu.org
Subject: bug#10117: duplicate evaluation of after-change-functions hooks in revert-buffer
Date: Thu, 01 Dec 2011 15:23:29 -0500	[thread overview]
Message-ID: <jwvvcq09hgc.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4ECD0A5D.90907@inria.fr>

>> 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)
     {






      parent reply	other threads:[~2011-12-01 20:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 11:18 bug#10117: duplicate evaluation of after-change-functions hooks in revert-buffer Tiphaine Turpin
2011-11-23 14:42 ` Stefan Monnier
     [not found]   ` <4ECD0A5D.90907@inria.fr>
2011-12-01 20:23     ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvvcq09hgc.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=10117-done@debbugs.gnu.org \
    --cc=tiphaine.turpin@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).