Mercurial > hg > xemacs-beta
diff lisp/font-lock.el @ 5470:0af042a0c116
Merge with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Mon, 07 Feb 2011 21:22:17 +0100 |
parents | 308d34e9f07d 239193591765 |
children | cc6f0266bc36 |
line wrap: on
line diff
--- a/lisp/font-lock.el Sat Jan 22 00:59:20 2011 +0100 +++ b/lisp/font-lock.el Mon Feb 07 21:22:17 2011 +0100 @@ -1475,51 +1475,55 @@ (save-match-data (maphash #'(lambda (buffer dummy) - ;; remove first, to avoid infinite reprocessing if error - (remhash buffer font-lock-pending-buffer-table) - (when (buffer-live-p buffer) - (clear-range-table font-lock-range-table) - (with-current-buffer buffer - (save-excursion - (save-restriction - ;; if we don't widen, then the C code in - ;; syntactically-sectionize will fail to realize that - ;; we're inside a comment. #### We don't actually use - ;; syntactically-sectionize any more. Do we still - ;; need the widen? - (widen) - (map-extents - #'(lambda (ex dummy-maparg) - ;; first expand the ranges to full lines, - ;; because that is what will be fontified; - ;; then use a range table to merge the - ;; ranges. (we could also do this simply using - ;; text properties. the range table code was - ;; here from a previous version of this code - ;; and works just as well.) - (let* ((beg (extent-start-position ex)) - (end (extent-end-position ex)) - (beg (progn (goto-char beg) - (beginning-of-line) - (point))) - (end (progn (goto-char end) - (forward-line 1) - (point)))) - (put-range-table beg end t - font-lock-range-table))) - nil nil nil nil nil 'font-lock-pending t) - ;; clear all pending extents first in case of error below. - (put-text-property (point-min) (point-max) - 'font-lock-pending nil) - (map-range-table - #'(lambda (beg end val) + (catch 'exit + ;; font-lock-mode may be temporarily unset during `revert-buffer' + (if (not font-lock-mode) + (throw 'exit nil)) + ;; remove first, to avoid infinite reprocessing if error + (remhash buffer font-lock-pending-buffer-table) + (when (buffer-live-p buffer) + (clear-range-table font-lock-range-table) + (with-current-buffer buffer + (save-excursion + (save-restriction + ;; if we don't widen, then the C code in + ;; syntactically-sectionize will fail to realize that + ;; we're inside a comment. #### We don't actually use + ;; syntactically-sectionize any more. Do we still + ;; need the widen? + (widen) + (map-extents + #'(lambda (ex dummy-maparg) + ;; first expand the ranges to full lines, + ;; because that is what will be fontified; + ;; then use a range table to merge the + ;; ranges. (we could also do this simply using + ;; text properties. the range table code was + ;; here from a previous version of this code + ;; and works just as well.) + (let* ((beg (extent-start-position ex)) + (end (extent-end-position ex)) + (beg (progn (goto-char beg) + (beginning-of-line) + (point))) + (end (progn (goto-char end) + (forward-line 1) + (point)))) + (put-range-table beg end t + font-lock-range-table))) + nil nil nil nil nil 'font-lock-pending t) + ;; clear all pending extents first in case of error below. + (put-text-property (point-min) (point-max) + 'font-lock-pending nil) + (map-range-table + #'(lambda (beg end val) ;; This creates some unnecessary progress gauges. ;; (if (and (= beg (point-min)) ;; (= end (point-max))) ;; (font-lock-fontify-buffer) ;; (font-lock-fontify-region beg end))) - (font-lock-fontify-region beg end)) - font-lock-range-table)))))) + (font-lock-fontify-region beg end)) + font-lock-range-table))))))) font-lock-pending-buffer-table))) ;; Syntactic fontification functions.