Mercurial > hg > xemacs-beta
comparison lisp/packages/font-lock.el @ 193:f53b5ca2e663 r20-3b23
Import from CVS: tag r20-3b23
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:58:30 +0200 |
parents | 0132846995bd |
children | a2f645c6b9f8 |
comparison
equal
deleted
inserted
replaced
192:9d35321dd38c | 193:f53b5ca2e663 |
---|---|
581 (cond (font-lock-fontified | 581 (cond (font-lock-fontified |
582 nil) | 582 nil) |
583 ((or (null maximum-size) (<= (buffer-size) maximum-size)) | 583 ((or (null maximum-size) (<= (buffer-size) maximum-size)) |
584 (font-lock-fontify-buffer)) | 584 (font-lock-fontify-buffer)) |
585 (font-lock-verbose | 585 (font-lock-verbose |
586 (message "Fontifying %s... buffer too big." (buffer-name))))) | 586 (display-message |
587 'command | |
588 (format "Fontifying %s... buffer too big." (buffer-name)))))) | |
587 (font-lock-fontified | 589 (font-lock-fontified |
588 (setq font-lock-fontified nil) | 590 (setq font-lock-fontified nil) |
589 (remove-hook 'before-revert-hook 'font-lock-revert-setup t) | 591 (remove-hook 'before-revert-hook 'font-lock-revert-setup t) |
590 (remove-hook 'after-revert-hook 'font-lock-revert-cleanup t) | 592 (remove-hook 'after-revert-hook 'font-lock-revert-cleanup t) |
591 (font-lock-unfontify-region (point-min) (point-max)) | 593 (font-lock-unfontify-region (point-min) (point-max)) |
643 (or was-on ; turn it off if it was off. | 645 (or was-on ; turn it off if it was off. |
644 (let ((font-lock-fontified nil)) ; kludge to prevent defontification | 646 (let ((font-lock-fontified nil)) ; kludge to prevent defontification |
645 (font-lock-mode 0))) | 647 (font-lock-mode 0))) |
646 (set (make-local-variable 'font-lock-fontified) t) | 648 (set (make-local-variable 'font-lock-fontified) t) |
647 (if (and aborted font-lock-verbose) | 649 (if (and aborted font-lock-verbose) |
648 (message "Fontifying %s... aborted." (buffer-name))) | 650 (display-message 'command |
651 (format "Fontifying %s... aborted." (buffer-name)))) | |
649 ) | 652 ) |
650 (run-hooks 'font-lock-after-fontify-buffer-hook)) | 653 (run-hooks 'font-lock-after-fontify-buffer-hook)) |
651 | 654 |
652 ;; Fontification functions. | 655 ;; Fontification functions. |
653 | 656 |
723 ; (font-lock-fontify-keywords-region beg end)) | 726 ; (font-lock-fontify-keywords-region beg end)) |
724 | 727 |
725 (defun font-lock-unfontify-region (beg end &optional maybe-loudly) | 728 (defun font-lock-unfontify-region (beg end &optional maybe-loudly) |
726 (if (and maybe-loudly font-lock-verbose | 729 (if (and maybe-loudly font-lock-verbose |
727 (>= (- end beg) font-lock-message-threshold)) | 730 (>= (- end beg) font-lock-message-threshold)) |
728 (message "Fontifying %s..." (buffer-name))) | 731 (display-message |
732 'progress | |
733 (format "Fontifying %s..." (buffer-name)))) | |
729 (let ((modified (buffer-modified-p)) | 734 (let ((modified (buffer-modified-p)) |
730 (buffer-undo-list t) (inhibit-read-only t) | 735 (buffer-undo-list t) (inhibit-read-only t) |
731 buffer-file-name buffer-file-truename) | 736 buffer-file-name buffer-file-truename) |
732 (font-lock-remove-face beg end) | 737 (font-lock-remove-face beg end) |
733 (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil)))) | 738 (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil)))) |
974 START should be at the beginning of a line." | 979 START should be at the beginning of a line." |
975 (if font-lock-keywords-only | 980 (if font-lock-keywords-only |
976 nil | 981 nil |
977 (if (and font-lock-verbose | 982 (if (and font-lock-verbose |
978 (>= (- end start) font-lock-message-threshold)) | 983 (>= (- end start) font-lock-message-threshold)) |
979 (message "Fontifying %s... (syntactically...)" (buffer-name))) | 984 (display-message |
985 'progress | |
986 (format "Fontifying %s... (syntactically...)" (buffer-name)))) | |
980 (font-lock-unfontify-region start end loudly) | 987 (font-lock-unfontify-region start end loudly) |
981 (goto-char start) | 988 (goto-char start) |
982 (if (> end (point-max)) (setq end (point-max))) | 989 (if (> end (point-max)) (setq end (point-max))) |
983 (syntactically-sectionize | 990 (syntactically-sectionize |
984 #'(lambda (s e context depth) | 991 #'(lambda (s e context depth) |
1160 (bufname (buffer-name)) (count 0) | 1167 (bufname (buffer-name)) (count 0) |
1161 keyword matcher highlights) | 1168 keyword matcher highlights) |
1162 ;; | 1169 ;; |
1163 ;; Fontify each item in `font-lock-keywords' from `start' to `end'. | 1170 ;; Fontify each item in `font-lock-keywords' from `start' to `end'. |
1164 (while keywords | 1171 (while keywords |
1165 (if loudly (message "Fontifying %s... (regexps..%s)" bufname | 1172 (if loudly (display-message |
1166 (make-string (setq count (1+ count)) ?.))) | 1173 'progress |
1174 (format "Fontifying %s... (regexps..%s)" bufname | |
1175 (make-string (setq count (1+ count)) ?.)))) | |
1167 ;; | 1176 ;; |
1168 ;; Find an occurrence of `matcher' from `start' to `end'. | 1177 ;; Find an occurrence of `matcher' from `start' to `end'. |
1169 (setq keyword (car keywords) matcher (car keyword)) | 1178 (setq keyword (car keywords) matcher (car keyword)) |
1170 (goto-char start) | 1179 (goto-char start) |
1171 (while (and (< (point) end) | 1180 (while (and (< (point) end) |
1179 (if (numberp (car (car highlights))) | 1188 (if (numberp (car (car highlights))) |
1180 (font-lock-apply-highlight (car highlights)) | 1189 (font-lock-apply-highlight (car highlights)) |
1181 (font-lock-fontify-anchored-keywords (car highlights) end)) | 1190 (font-lock-fontify-anchored-keywords (car highlights) end)) |
1182 (setq highlights (cdr highlights)))) | 1191 (setq highlights (cdr highlights)))) |
1183 (setq keywords (cdr keywords)))) | 1192 (setq keywords (cdr keywords)))) |
1184 (if loudly (message "Fontifying %s... done." (buffer-name))))) | 1193 (if loudly (display-message |
1194 'progress | |
1195 (format "Fontifying %s... done." (buffer-name)))))) | |
1185 | 1196 |
1186 | 1197 |
1187 ;; Various functions. | 1198 ;; Various functions. |
1188 | 1199 |
1189 ;; Turn off other related packages if they're on. I prefer a hook. --sm. | 1200 ;; Turn off other related packages if they're on. I prefer a hook. --sm. |