diff options
| author | Stefan Monnier | 2000-10-15 04:51:57 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-10-15 04:51:57 +0000 |
| commit | c0a6a9fe280b6cc1efb87d982f4ec073627d3816 (patch) | |
| tree | 88c4e31cef0032256bd910ccd082086e7aaf27f6 | |
| parent | 30cdf899d795651977cd4b4b761671024f06f747 (diff) | |
| download | emacs-c0a6a9fe280b6cc1efb87d982f4ec073627d3816.tar.gz emacs-c0a6a9fe280b6cc1efb87d982f4ec073627d3816.zip | |
(font-lock-syntactically-fontified): New var.
(font-lock-fontify-syntactic-keywords-region): Use it.
(font-lock-mode): Fix docstring. Don't need make-local-hook anymore.
| -rw-r--r-- | lisp/font-lock.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 54dfe17de5a..a6b05e5f870 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -511,6 +511,12 @@ This is normally set via `font-lock-defaults'.") | |||
| 511 | "*Non-nil means the patterns in `font-lock-keywords' are case-insensitive. | 511 | "*Non-nil means the patterns in `font-lock-keywords' are case-insensitive. |
| 512 | This is normally set via `font-lock-defaults'.") | 512 | This is normally set via `font-lock-defaults'.") |
| 513 | 513 | ||
| 514 | (defvar font-lock-syntactically-fontified 0 | ||
| 515 | "Point up to which `font-lock-syntactic-keywords' has been applied. | ||
| 516 | If nil, this is ignored, in which case the syntactic fontification may | ||
| 517 | sometimes be slightly incorrect.") | ||
| 518 | (make-variable-buffer-local 'font-lock-syntactically-fontified) | ||
| 519 | |||
| 514 | (defvar font-lock-syntactic-keywords nil | 520 | (defvar font-lock-syntactic-keywords nil |
| 515 | "A list of the syntactic keywords to highlight. | 521 | "A list of the syntactic keywords to highlight. |
| 516 | Can be the list or the name of a function or variable whose value is the list. | 522 | Can be the list or the name of a function or variable whose value is the list. |
| @@ -638,7 +644,7 @@ Major/minor modes can set this variable if they know which option applies.") | |||
| 638 | (defun font-lock-mode (&optional arg) | 644 | (defun font-lock-mode (&optional arg) |
| 639 | "Toggle Font Lock mode. | 645 | "Toggle Font Lock mode. |
| 640 | With arg, turn Font Lock mode on if and only if arg is positive. | 646 | With arg, turn Font Lock mode on if and only if arg is positive. |
| 641 | (Font Lock is also known as \"syntax highlighting\".) | 647 | \(Font Lock is also known as \"syntax highlighting\".) |
| 642 | 648 | ||
| 643 | When Font Lock mode is enabled, text is fontified as you type it: | 649 | When Font Lock mode is enabled, text is fontified as you type it: |
| 644 | 650 | ||
| @@ -699,7 +705,6 @@ buffer local value for `font-lock-defaults', via its mode hook." | |||
| 699 | (set (make-local-variable 'font-lock-mode) on-p) | 705 | (set (make-local-variable 'font-lock-mode) on-p) |
| 700 | ;; Turn on Font Lock mode. | 706 | ;; Turn on Font Lock mode. |
| 701 | (when on-p | 707 | (when on-p |
| 702 | (make-local-hook 'after-change-functions) | ||
| 703 | (add-hook 'after-change-functions 'font-lock-after-change-function nil t) | 708 | (add-hook 'after-change-functions 'font-lock-after-change-function nil t) |
| 704 | (font-lock-set-defaults) | 709 | (font-lock-set-defaults) |
| 705 | (font-lock-turn-on-thing-lock) | 710 | (font-lock-turn-on-thing-lock) |
| @@ -1447,6 +1452,11 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." | |||
| 1447 | (defun font-lock-fontify-syntactic-keywords-region (start end) | 1452 | (defun font-lock-fontify-syntactic-keywords-region (start end) |
| 1448 | "Fontify according to `font-lock-syntactic-keywords' between START and END. | 1453 | "Fontify according to `font-lock-syntactic-keywords' between START and END. |
| 1449 | START should be at the beginning of a line." | 1454 | START should be at the beginning of a line." |
| 1455 | ;; Ensure the beginning of the file is properly syntactic-fontified. | ||
| 1456 | (when (and font-lock-syntactically-fontified | ||
| 1457 | (< font-lock-syntactically-fontified start)) | ||
| 1458 | (setq start (max font-lock-syntactically-fontified (point-min))) | ||
| 1459 | (setq font-lock-syntactically-fontified end)) | ||
| 1450 | ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords. | 1460 | ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords. |
| 1451 | (when (symbolp font-lock-syntactic-keywords) | 1461 | (when (symbolp font-lock-syntactic-keywords) |
| 1452 | (setq font-lock-syntactic-keywords (font-lock-eval-keywords | 1462 | (setq font-lock-syntactic-keywords (font-lock-eval-keywords |