diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-01-24 17:05:52 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-01-24 17:05:52 -0500 |
commit | f996bbcb94dd456d0c5644885e8269f396b54707 (patch) | |
tree | c6c601367ab5e94cd62e994f660e8f9e65498d10 | |
parent | 10e1d5f30f7ccb099106a3644776ed68db98b2d7 (diff) | |
download | emacs-f996bbcb94dd456d0c5644885e8269f396b54707.tar.gz |
* xdisp.c (handle_fontified_prop): Be careful with font-lock changing
the buffer's point-max.
Fixes: debbugs:7876
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/xdisp.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 297ea12aee7..0539b849efc 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. */ |