emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103750: Discard changes to buffer->c


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103750: Discard changes to buffer->clip_changed incurred during fontification.
Date: Fri, 25 Mar 2011 16:00:25 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103750
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2011-03-25 16:00:25 -0400
message:
  Discard changes to buffer->clip_changed incurred during fontification.
  
  * src/xdisp.c (handle_fontified_prop): Discard changes to clip_changed
  incurred during fontification.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-03-25 18:06:33 +0000
+++ b/src/ChangeLog     2011-03-25 20:00:25 +0000
@@ -1,3 +1,8 @@
+2011-03-25  Chong Yidong  <address@hidden>
+
+       * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
+       incurred during fontification.
+
 2011-03-25  Juanma Barranquero  <address@hidden>
 
        * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-03-22 08:15:43 +0000
+++ b/src/xdisp.c       2011-03-25 20:00:25 +0000
@@ -3164,6 +3164,9 @@
     {
       int count = SPECPDL_INDEX ();
       Lisp_Object val;
+      struct buffer *obuf = current_buffer;
+      int begv = BEGV, zv = ZV;
+      int old_clip_changed = current_buffer->clip_changed;
 
       val = Vfontification_functions;
       specbind (Qfontification_functions, Qnil);
@@ -3209,6 +3212,23 @@
 
       unbind_to (count, Qnil);
 
+      /* Fontification functions routinely call `save-restriction'.
+        Normally, this tags clip_changed, which can confuse redisplay
+        (see discussion in Bug#6671).  Since we don't perform any
+        special handling of fontification changes in the case where
+        `save-restriction' isn't called, there's no point doing so in
+        this case either.  So, if the buffer's restrictions are
+        actually left unchanged, reset clip_changed.  */
+      if (obuf == current_buffer)
+       {
+         if (begv == BEGV && zv == ZV)
+           current_buffer->clip_changed = old_clip_changed;
+       }
+      /* There isn't much we can reasonably do to protect against
+        misbehaving fontification, but here's a fig leaf.  */
+      else if (!NILP (BVAR (obuf, name)))
+       set_buffer_internal_1 (obuf);
+
       /* The fontification code may have added/removed text.
         It could do even a lot worse, but let's at least protect against
         the most obvious case where only the text past `pos' gets changed',


reply via email to

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