summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-01-24 17:05:52 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-01-24 17:05:52 -0500
commit1a96252b25d35d55301cfd9459e5015406d78a45 (patch)
treef6e33d2ea4a01615e2fb94dd92e7324f30a1151f
parent33d414a72b31eff2b146e1ac9d58d4a733e9a99d (diff)
downloademacs-1a96252b25d35d55301cfd9459e5015406d78a45.tar.gz
* xdisp.c (handle_fontified_prop): Be careful with font-lock changing
the buffer's point-max.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 391573bf06d..9793c107f82 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-24 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * xdisp.c (handle_fontified_prop): Be careful with font-lock changing
+ the buffer's point-max (bug#7876).
+
2011-01-23 Chong Yidong <cyd@stupidchicken.com>
* lisp.h (XPNTR): Obey DATA_SEG_BITS in all non-USE_LSB_TAG cases.
diff --git a/src/xdisp.c b/src/xdisp.c
index 219150b9f97..d625b05075d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3337,6 +3337,8 @@ handle_fontified_prop (it)
val = Vfontification_functions;
specbind (Qfontification_functions, Qnil);
+ xassert (it->end_charpos == ZV);
+
if (!CONSP (val) || EQ (XCAR (val), Qlambda))
safe_call1 (val, pos);
else
@@ -3376,6 +3378,13 @@ handle_fontified_prop (it)
unbind_to (count, Qnil);
+ /* 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',
+ as is/was done in grep.el where some escapes sequences are turned
+ into face properties (bug#7876). */
+ it->end_charpos = ZV;
+
/* Return HANDLED_RECOMPUTE_PROPS only if function fontified
something. This avoids an endless loop if they failed to
fontify the text for which reason ever. */