aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/font-lock.el14
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.
512This is normally set via `font-lock-defaults'.") 512This 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.
516If nil, this is ignored, in which case the syntactic fontification may
517sometimes 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.
516Can be the list or the name of a function or variable whose value is the list. 522Can 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.
640With arg, turn Font Lock mode on if and only if arg is positive. 646With 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
643When Font Lock mode is enabled, text is fontified as you type it: 649When 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.
1449START should be at the beginning of a line." 1454START 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