aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1998-11-23 11:12:40 +0000
committerSimon Marshall1998-11-23 11:12:40 +0000
commit79f238c95f0f2e3a696df128fe3b68e75384f4ef (patch)
tree6fe0dab8aa9f87580a5a275b296155f2efb3d92b
parent582e5ff70c61921a8104265dca636f424b317f8e (diff)
downloademacs-79f238c95f0f2e3a696df128fe3b68e75384f4ef.tar.gz
emacs-79f238c95f0f2e3a696df128fe3b68e75384f4ef.zip
* font-lock.el (font-lock-defaults): Doc fix.
(font-lock-default-fontify-buffer): Rewritten to use with-temp-message. (lisp-font-lock-keywords-2): Fontify with-temp-message as a keyword.
-rw-r--r--lisp/font-lock.el70
1 files changed, 26 insertions, 44 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 4a07a0151be..2e3bec5b057 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -428,7 +428,9 @@ Typical values are `mark-defun' for programming modes or `mark-paragraph' for
428textual modes (i.e., the mode-dependent function is known to put point and mark 428textual modes (i.e., the mode-dependent function is known to put point and mark
429around a text block relevant to that mode). 429around a text block relevant to that mode).
430 430
431Other variables include those for buffer-specialised fontification functions, 431Other variables include that for syntactic keyword fontification,
432`font-lock-syntactic-keywords'
433and those for buffer-specialised fontification functions,
432`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', 434`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function',
433`font-lock-fontify-region-function', `font-lock-unfontify-region-function', 435`font-lock-fontify-region-function', `font-lock-unfontify-region-function',
434`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.") 436`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.")
@@ -442,48 +444,36 @@ Other variables include those for buffer-specialised fontification functions,
442 '((c-font-lock-keywords c-font-lock-keywords-1 444 '((c-font-lock-keywords c-font-lock-keywords-1
443 c-font-lock-keywords-2 c-font-lock-keywords-3) 445 c-font-lock-keywords-2 c-font-lock-keywords-3)
444 nil nil ((?_ . "w")) beginning-of-defun 446 nil nil ((?_ . "w")) beginning-of-defun
445 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
446 ;(font-lock-comment-start-regexp . "/[*/]")
447 (font-lock-mark-block-function . mark-defun))) 447 (font-lock-mark-block-function . mark-defun)))
448 (c++-mode-defaults 448 (c++-mode-defaults
449 '((c++-font-lock-keywords c++-font-lock-keywords-1 449 '((c++-font-lock-keywords c++-font-lock-keywords-1
450 c++-font-lock-keywords-2 c++-font-lock-keywords-3) 450 c++-font-lock-keywords-2 c++-font-lock-keywords-3)
451 nil nil ((?_ . "w")) beginning-of-defun 451 nil nil ((?_ . "w")) beginning-of-defun
452 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
453 ;(font-lock-comment-start-regexp . "/[*/]")
454 (font-lock-mark-block-function . mark-defun))) 452 (font-lock-mark-block-function . mark-defun)))
455 (objc-mode-defaults 453 (objc-mode-defaults
456 '((objc-font-lock-keywords objc-font-lock-keywords-1 454 '((objc-font-lock-keywords objc-font-lock-keywords-1
457 objc-font-lock-keywords-2 objc-font-lock-keywords-3) 455 objc-font-lock-keywords-2 objc-font-lock-keywords-3)
458 nil nil ((?_ . "w") (?$ . "w")) nil 456 nil nil ((?_ . "w") (?$ . "w")) nil
459 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
460 ;(font-lock-comment-start-regexp . "/[*/]")
461 (font-lock-mark-block-function . mark-defun))) 457 (font-lock-mark-block-function . mark-defun)))
462 (java-mode-defaults 458 (java-mode-defaults
463 '((java-font-lock-keywords java-font-lock-keywords-1 459 '((java-font-lock-keywords java-font-lock-keywords-1
464 java-font-lock-keywords-2 java-font-lock-keywords-3) 460 java-font-lock-keywords-2 java-font-lock-keywords-3)
465 nil nil ((?_ . "w") (?$ . "w") (?. . "w")) nil 461 nil nil ((?_ . "w") (?$ . "w") (?. . "w")) nil
466 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
467 ;(font-lock-comment-start-regexp . "/[*/]")
468 (font-lock-mark-block-function . mark-defun))) 462 (font-lock-mark-block-function . mark-defun)))
469 (lisp-mode-defaults 463 (lisp-mode-defaults
470 '((lisp-font-lock-keywords 464 '((lisp-font-lock-keywords
471 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) 465 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2)
472 nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun 466 nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun
473 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
474 ;(font-lock-comment-start-regexp . ";")
475 (font-lock-mark-block-function . mark-defun))) 467 (font-lock-mark-block-function . mark-defun)))
476 ;; For TeX modes we could use `backward-paragraph' for the same reason. 468 ;; For TeX modes we could use `backward-paragraph' for the same reason.
477 ;; But we don't, because paragraph breaks are arguably likely enough to 469 ;; But we don't, because paragraph breaks are arguably likely enough to
478 ;; occur within a genuine syntactic block to make it too risky. 470 ;; occur within a genuine syntactic block to make it too risky.
479 ;; However, we do specify a MARK-BLOCK function as that cannot result 471 ;; However, we do specify a MARK-BLOCK function as that cannot result
480 ;; in a mis-fontification even if it might not fontify enough. --sm. 472 ;; in a mis-fontification even if it might not fontify enough. sm.
481 (tex-mode-defaults 473 (tex-mode-defaults
482 '((tex-font-lock-keywords 474 '((tex-font-lock-keywords
483 tex-font-lock-keywords-1 tex-font-lock-keywords-2) 475 tex-font-lock-keywords-1 tex-font-lock-keywords-2)
484 nil nil ((?$ . "\"")) nil 476 nil nil ((?$ . "\"")) nil
485 ;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
486 ;(font-lock-comment-start-regexp . "%")
487 (font-lock-mark-block-function . mark-paragraph))) 477 (font-lock-mark-block-function . mark-paragraph)))
488 ) 478 )
489 (list 479 (list
@@ -573,14 +563,6 @@ When called with no args it should leave point at the beginning of any
573enclosing textual block and mark at the end. 563enclosing textual block and mark at the end.
574This is normally set via `font-lock-defaults'.") 564This is normally set via `font-lock-defaults'.")
575 565
576;; Obsoleted by Emacs 20 parse-partial-sexp's COMMENTSTOP.
577;(defvar font-lock-comment-start-regexp nil
578; "*Regexp to match the start of a comment.
579;This need not discriminate between genuine comments and quoted comment
580;characters or comment characters within strings.
581;If nil, `comment-start-skip' is used instead; see that variable for more info.
582;This is normally set via `font-lock-defaults'.")
583
584(defvar font-lock-fontify-buffer-function 'font-lock-default-fontify-buffer 566(defvar font-lock-fontify-buffer-function 'font-lock-default-fontify-buffer
585 "Function to use for fontifying the buffer. 567 "Function to use for fontifying the buffer.
586This is normally set via `font-lock-defaults'.") 568This is normally set via `font-lock-defaults'.")
@@ -1049,27 +1031,27 @@ The value of this variable is used when Font Lock mode is turned on."
1049 (let ((verbose (if (numberp font-lock-verbose) 1031 (let ((verbose (if (numberp font-lock-verbose)
1050 (> (buffer-size) font-lock-verbose) 1032 (> (buffer-size) font-lock-verbose)
1051 font-lock-verbose))) 1033 font-lock-verbose)))
1052 (when verbose 1034 (with-temp-message
1053 (message "Fontifying %s..." (buffer-name))) 1035 (if verbose
1054 ;; Make sure we have the right `font-lock-keywords' etc. 1036 (format "Fontifying %s..." (buffer-name))
1055 (unless font-lock-mode 1037 (current-message))
1056 (font-lock-set-defaults)) 1038 ;; Make sure we have the right `font-lock-keywords' etc.
1057 ;; Make sure we fontify etc. in the whole buffer. 1039 (unless font-lock-mode
1058 (save-restriction 1040 (font-lock-set-defaults))
1059 (widen) 1041 ;; Make sure we fontify etc. in the whole buffer.
1060 (condition-case nil 1042 (save-restriction
1061 (save-excursion 1043 (widen)
1062 (save-match-data 1044 (condition-case nil
1063 (font-lock-fontify-region (point-min) (point-max) verbose) 1045 (save-excursion
1064 (font-lock-after-fontify-buffer) 1046 (save-match-data
1065 (setq font-lock-fontified t))) 1047 (font-lock-fontify-region (point-min) (point-max) verbose)
1066 ;; We don't restore the old fontification, so it's best to unfontify. 1048 (font-lock-after-fontify-buffer)
1067 (quit (font-lock-unfontify-buffer)))) 1049 (setq font-lock-fontified t)))
1068 ;; Make sure we undo `font-lock-keywords' etc. 1050 ;; We don't restore the old fontification, so it's best to unfontify.
1069 (unless font-lock-mode 1051 (quit (font-lock-unfontify-buffer))))
1070 (font-lock-unset-defaults)) 1052 ;; Make sure we undo `font-lock-keywords' etc.
1071 (if verbose (message "Fontifying %s...%s" (buffer-name) 1053 (unless font-lock-mode
1072 (if font-lock-fontified "done" "quit"))))) 1054 (font-lock-unset-defaults)))))
1073 1055
1074(defun font-lock-default-unfontify-buffer () 1056(defun font-lock-default-unfontify-buffer ()
1075 ;; Make sure we unfontify etc. in the whole buffer. 1057 ;; Make sure we unfontify etc. in the whole buffer.
@@ -1949,7 +1931,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1949 "eval-when" 1931 "eval-when"
1950 "with-current-buffer" "with-electric-help" 1932 "with-current-buffer" "with-electric-help"
1951 "with-output-to-string" "with-output-to-temp-buffer" 1933 "with-output-to-string" "with-output-to-temp-buffer"
1952 "with-temp-buffer" "with-temp-file" 1934 "with-temp-buffer" "with-temp-file" "with-temp-message"
1953 "with-timeout") t) 1935 "with-timeout") t)
1954 "\\>") 1936 "\\>")
1955 1) 1937 1)