Mercurial > emacs
changeset 47725:2cf6194833de
(jit-lock-fontify-now): Don't widen.
Let the jit-lock-functions do it if they want to.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 01 Oct 2002 16:54:42 +0000 |
parents | a9daf35fd318 |
children | 33d53d287ee4 |
files | lisp/jit-lock.el |
diffstat | 1 files changed, 34 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/jit-lock.el Tue Oct 01 16:29:40 2002 +0000 +++ b/lisp/jit-lock.el Tue Oct 01 16:54:42 2002 +0000 @@ -297,45 +297,43 @@ Defaults to the whole buffer. END can be out of bounds." (with-buffer-prepared-for-jit-lock (save-excursion - (save-restriction - (widen) - (unless start (setq start (point-min))) - (setq end (if end (min end (point-max)) (point-max))) - ;; This did bind `font-lock-beginning-of-syntax-function' to - ;; nil at some point, for an unknown reason. Don't do this; it - ;; can make highlighting slow due to expensive calls to - ;; `parse-partial-sexp' in function - ;; `font-lock-fontify-syntactically-region'. Example: paging - ;; from the end of a buffer to its start, can do repeated - ;; `parse-partial-sexp' starting from `point-min', which can - ;; take a long time in a large buffer. - (let (next) - (save-match-data - ;; Fontify chunks beginning at START. The end of a - ;; chunk is either `end', or the start of a region - ;; before `end' that has already been fontified. - (while start - ;; Determine the end of this chunk. - (setq next (or (text-property-any start end 'fontified t) - end)) + (unless start (setq start (point-min))) + (setq end (if end (min end (point-max)) (point-max))) + ;; This did bind `font-lock-beginning-of-syntax-function' to + ;; nil at some point, for an unknown reason. Don't do this; it + ;; can make highlighting slow due to expensive calls to + ;; `parse-partial-sexp' in function + ;; `font-lock-fontify-syntactically-region'. Example: paging + ;; from the end of a buffer to its start, can do repeated + ;; `parse-partial-sexp' starting from `point-min', which can + ;; take a long time in a large buffer. + (let (next) + (save-match-data + ;; Fontify chunks beginning at START. The end of a + ;; chunk is either `end', or the start of a region + ;; before `end' that has already been fontified. + (while start + ;; Determine the end of this chunk. + (setq next (or (text-property-any start end 'fontified t) + end)) - ;; Decide which range of text should be fontified. - ;; The problem is that START and NEXT may be in the - ;; middle of something matched by a font-lock regexp. - ;; Until someone has a better idea, let's start - ;; at the start of the line containing START and - ;; stop at the start of the line following NEXT. - (goto-char next) (setq next (line-beginning-position 2)) - (goto-char start) (setq start (line-beginning-position)) + ;; Decide which range of text should be fontified. + ;; The problem is that START and NEXT may be in the + ;; middle of something matched by a font-lock regexp. + ;; Until someone has a better idea, let's start + ;; at the start of the line containing START and + ;; stop at the start of the line following NEXT. + (goto-char next) (setq next (line-beginning-position 2)) + (goto-char start) (setq start (line-beginning-position)) - ;; Fontify the chunk, and mark it as fontified. - ;; We mark it first, to make sure that we don't indefinitely - ;; re-execute this fontification if an error occurs. - (put-text-property start next 'fontified t) - (run-hook-with-args 'jit-lock-functions start next) + ;; Fontify the chunk, and mark it as fontified. + ;; We mark it first, to make sure that we don't indefinitely + ;; re-execute this fontification if an error occurs. + (put-text-property start next 'fontified t) + (run-hook-with-args 'jit-lock-functions start next) - ;; Find the start of the next chunk, if any. - (setq start (text-property-any next end 'fontified nil))))))))) + ;; Find the start of the next chunk, if any. + (setq start (text-property-any next end 'fontified nil)))))))) ;;; Stealth fontification.