Thanks for working on this. The deeper problem is, if there is some regex-based-font-lock face in > region A (applied when Emacs fontified region A), eg, highlighted TODO > keywords in a docstring, they will be overwritten by the string face, if we > just apply string face to the whole string and trigger redisplay. > I still need to get familiar with the parts of the code involved. But can we avoid this (potentially) expensive re-fontification by keeping a list of text properties/fonts applied to a region? Because if the region was not changed, aside from adding/removing comments, then it would not need to be re-parsed. > What I ended up doing is to set jit-lock-context-unfontify-pos to the > beginning of the string node (aka beginning of region A). Then in a timer > jit-lock-context will refontify everything after that position. And I have > some measure to break possible infinite recursion (fontify region -> set > jit-lock-context-unfontify-pos -> cause refontification -> fontify region > -> …). > I still need to look at your fix more carefully as a similar issue exists for sh-mode and heredoc strings. -- João Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca