>>Suppose not: Wouldn't that mean `font-lock-lines-before' is useless? > > > Not at all.
Then you mean that `font-lock-lines-before' is useless with jit-lock? > ... font-lock-lines-before has not been introduced to force > refontification of the previous lines but because the N previous lines are > needed as context in order to properly refontify the current line. > Now the code does in fact refontify the previous lines, but it is > a side-effect rather than one of the original goals. > > When the "N previous lines" have not been fontified yet because they are before `window-start' you do have to fontify them anyway. Otherwise any - syntactical, for example - context infomation needed to fontify the current line correctly might be invalid. >>It's not very difficult to contrive test cases for this. By default >>`font-lock-multiline' is nil. `font-lock-fontify-anchored-keywords' >>won't alter it - the appropriate lines have been commented out. Write >>an arbitrary multiline pattern. Now font-lock won't give it the >>`font-lock-multiline' text property and jit-lock not necessarily reset >>its `fontified' text property after a change. `font-lock-after-change', >>on the other hand, may refontify it provided `font-lock-lines-before' is >>large enough. > > > Please show me a test case. > > Try (defun foobar (bound) (while (re-search-forward "\\<foo\\>" bound 'bound) (save-excursion (when (re-search-forward "\\<bar\\>" (line-end-position 2) 'lep) (font-lock-prepend-text-property (match-beginning 0) (match-end 0) 'face 'font-lock-warning-face))))) (defun foobar-add () (interactive) (font-lock-add-keywords nil '(foobar . nil) t)) In some buffer do `foobar-add', write "foo" on one line and "bar" on the next. Plain font-lock will handle it, jit-lock won't. >>However, I believe that `font-lock-lines-before' is a brute force >>approach to handle such cases and could remarkably slow down editing if >>it were honored by jit-lock mode. Multiline patterns are too delicate >>and should be treated in a completely different way. > > > Indeed, but nobody has put the work needed to handle them properly. > font-lock-multiline is one hack, font-lock-lines-before is another, > font-lock-fontification-face-function is yet another. I don't know about font-lock-fontification-face-function. `font-lock-multiline' is not a hack, at least not a priori. It simply has not been developed yet. `font-lock-lines-before' is a brute hack. However, until `font-lock-multiline' is implemented correctly, it might be better than nothing. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel