comparison 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
comparison
equal deleted inserted replaced
5469:2a8a04f73c15 5470:0af042a0c116
1473 ;; this function is actually shorter than the old version, which handled 1473 ;; this function is actually shorter than the old version, which handled
1474 ;; only one buffer and one contiguous region! 1474 ;; only one buffer and one contiguous region!
1475 (save-match-data 1475 (save-match-data
1476 (maphash 1476 (maphash
1477 #'(lambda (buffer dummy) 1477 #'(lambda (buffer dummy)
1478 ;; remove first, to avoid infinite reprocessing if error 1478 (catch 'exit
1479 (remhash buffer font-lock-pending-buffer-table) 1479 ;; font-lock-mode may be temporarily unset during `revert-buffer'
1480 (when (buffer-live-p buffer) 1480 (if (not font-lock-mode)
1481 (clear-range-table font-lock-range-table) 1481 (throw 'exit nil))
1482 (with-current-buffer buffer 1482 ;; remove first, to avoid infinite reprocessing if error
1483 (save-excursion 1483 (remhash buffer font-lock-pending-buffer-table)
1484 (save-restriction 1484 (when (buffer-live-p buffer)
1485 ;; if we don't widen, then the C code in 1485 (clear-range-table font-lock-range-table)
1486 ;; syntactically-sectionize will fail to realize that 1486 (with-current-buffer buffer
1487 ;; we're inside a comment. #### We don't actually use 1487 (save-excursion
1488 ;; syntactically-sectionize any more. Do we still 1488 (save-restriction
1489 ;; need the widen? 1489 ;; if we don't widen, then the C code in
1490 (widen) 1490 ;; syntactically-sectionize will fail to realize that
1491 (map-extents 1491 ;; we're inside a comment. #### We don't actually use
1492 #'(lambda (ex dummy-maparg) 1492 ;; syntactically-sectionize any more. Do we still
1493 ;; first expand the ranges to full lines, 1493 ;; need the widen?
1494 ;; because that is what will be fontified; 1494 (widen)
1495 ;; then use a range table to merge the 1495 (map-extents
1496 ;; ranges. (we could also do this simply using 1496 #'(lambda (ex dummy-maparg)
1497 ;; text properties. the range table code was 1497 ;; first expand the ranges to full lines,
1498 ;; here from a previous version of this code 1498 ;; because that is what will be fontified;
1499 ;; and works just as well.) 1499 ;; then use a range table to merge the
1500 (let* ((beg (extent-start-position ex)) 1500 ;; ranges. (we could also do this simply using
1501 (end (extent-end-position ex)) 1501 ;; text properties. the range table code was
1502 (beg (progn (goto-char beg) 1502 ;; here from a previous version of this code
1503 (beginning-of-line) 1503 ;; and works just as well.)
1504 (point))) 1504 (let* ((beg (extent-start-position ex))
1505 (end (progn (goto-char end) 1505 (end (extent-end-position ex))
1506 (forward-line 1) 1506 (beg (progn (goto-char beg)
1507 (point)))) 1507 (beginning-of-line)
1508 (put-range-table beg end t 1508 (point)))
1509 font-lock-range-table))) 1509 (end (progn (goto-char end)
1510 nil nil nil nil nil 'font-lock-pending t) 1510 (forward-line 1)
1511 ;; clear all pending extents first in case of error below. 1511 (point))))
1512 (put-text-property (point-min) (point-max) 1512 (put-range-table beg end t
1513 'font-lock-pending nil) 1513 font-lock-range-table)))
1514 (map-range-table 1514 nil nil nil nil nil 'font-lock-pending t)
1515 #'(lambda (beg end val) 1515 ;; clear all pending extents first in case of error below.
1516 (put-text-property (point-min) (point-max)
1517 'font-lock-pending nil)
1518 (map-range-table
1519 #'(lambda (beg end val)
1516 ;; This creates some unnecessary progress gauges. 1520 ;; This creates some unnecessary progress gauges.
1517 ;; (if (and (= beg (point-min)) 1521 ;; (if (and (= beg (point-min))
1518 ;; (= end (point-max))) 1522 ;; (= end (point-max)))
1519 ;; (font-lock-fontify-buffer) 1523 ;; (font-lock-fontify-buffer)
1520 ;; (font-lock-fontify-region beg end))) 1524 ;; (font-lock-fontify-region beg end)))
1521 (font-lock-fontify-region beg end)) 1525 (font-lock-fontify-region beg end))
1522 font-lock-range-table)))))) 1526 font-lock-range-table)))))))
1523 font-lock-pending-buffer-table))) 1527 font-lock-pending-buffer-table)))
1524 1528
1525 ;; Syntactic fontification functions. 1529 ;; Syntactic fontification functions.
1526 1530
1527 (defun font-lock-lisp-like (mode) 1531 (defun font-lock-lisp-like (mode)