aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-03-25 16:00:25 -0400
committerChong Yidong2011-03-25 16:00:25 -0400
commit2ecf6fdb2806188ebf9f54a9bbead89be4803e75 (patch)
tree7c8316b379848ec11b8f53d965c19dc69b57d369
parent9ee0d174617ef235d5ec8d8d2393bfdce0a04d15 (diff)
downloademacs-2ecf6fdb2806188ebf9f54a9bbead89be4803e75.tar.gz
emacs-2ecf6fdb2806188ebf9f54a9bbead89be4803e75.zip
Discard changes to buffer->clip_changed incurred during fontification.
* src/xdisp.c (handle_fontified_prop): Discard changes to clip_changed incurred during fontification.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c20
2 files changed, 25 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bd06cd1869e..c7b0edede3f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12011-03-25 Chong Yidong <cyd@stupidchicken.com>
2
3 * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
4 incurred during fontification.
5
12011-03-25 Juanma Barranquero <lekktu@gmail.com> 62011-03-25 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'. 8 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.
diff --git a/src/xdisp.c b/src/xdisp.c
index 457a5e3e11b..cc5d61abdb2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3164,6 +3164,9 @@ handle_fontified_prop (struct it *it)
3164 { 3164 {
3165 int count = SPECPDL_INDEX (); 3165 int count = SPECPDL_INDEX ();
3166 Lisp_Object val; 3166 Lisp_Object val;
3167 struct buffer *obuf = current_buffer;
3168 int begv = BEGV, zv = ZV;
3169 int old_clip_changed = current_buffer->clip_changed;
3167 3170
3168 val = Vfontification_functions; 3171 val = Vfontification_functions;
3169 specbind (Qfontification_functions, Qnil); 3172 specbind (Qfontification_functions, Qnil);
@@ -3209,6 +3212,23 @@ handle_fontified_prop (struct it *it)
3209 3212
3210 unbind_to (count, Qnil); 3213 unbind_to (count, Qnil);
3211 3214
3215 /* Fontification functions routinely call `save-restriction'.
3216 Normally, this tags clip_changed, which can confuse redisplay
3217 (see discussion in Bug#6671). Since we don't perform any
3218 special handling of fontification changes in the case where
3219 `save-restriction' isn't called, there's no point doing so in
3220 this case either. So, if the buffer's restrictions are
3221 actually left unchanged, reset clip_changed. */
3222 if (obuf == current_buffer)
3223 {
3224 if (begv == BEGV && zv == ZV)
3225 current_buffer->clip_changed = old_clip_changed;
3226 }
3227 /* There isn't much we can reasonably do to protect against
3228 misbehaving fontification, but here's a fig leaf. */
3229 else if (!NILP (BVAR (obuf, name)))
3230 set_buffer_internal_1 (obuf);
3231
3212 /* The fontification code may have added/removed text. 3232 /* The fontification code may have added/removed text.
3213 It could do even a lot worse, but let's at least protect against 3233 It could do even a lot worse, but let's at least protect against
3214 the most obvious case where only the text past `pos' gets changed', 3234 the most obvious case where only the text past `pos' gets changed',