diff options
| author | Stefan Monnier | 2001-10-31 02:54:06 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-31 02:54:06 +0000 |
| commit | 9aa40401912b3fb44aa062f025bc7bc6962d9571 (patch) | |
| tree | 04e6200eb5691f83f14a0141bf74c537fa8b7674 | |
| parent | 8ab2646a67d00449f1af5a37a26660a36cc484cd (diff) | |
| download | emacs-9aa40401912b3fb44aa062f025bc7bc6962d9571.tar.gz emacs-9aa40401912b3fb44aa062f025bc7bc6962d9571.zip | |
(java-font-lock-syntactic-face-function): New fun.
(font-lock-defaults-alist): Use it. From David Ponce <david.ponce@wanadoo.fr>
| -rw-r--r-- | lisp/font-lock.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4431fc44258..e5fd64d2e45 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -526,7 +526,7 @@ and those for buffer-specialised fontification functions, | |||
| 526 | java-font-lock-keywords-2 java-font-lock-keywords-3) | 526 | java-font-lock-keywords-2 java-font-lock-keywords-3) |
| 527 | nil nil ((?_ . "w") (?$ . "w")) nil | 527 | nil nil ((?_ . "w") (?$ . "w")) nil |
| 528 | (font-lock-syntactic-face-function | 528 | (font-lock-syntactic-face-function |
| 529 | . c-font-lock-syntactic-face-function) | 529 | . java-font-lock-syntactic-face-function) |
| 530 | (font-lock-mark-block-function . mark-defun)))) | 530 | (font-lock-mark-block-function . mark-defun)))) |
| 531 | (list | 531 | (list |
| 532 | (cons 'c-mode c-mode-defaults) | 532 | (cons 'c-mode c-mode-defaults) |
| @@ -2986,6 +2986,24 @@ See also `java-font-lock-extra-types'.") | |||
| 2986 | 2986 | ||
| 2987 | ;; Provide ourselves: | 2987 | ;; Provide ourselves: |
| 2988 | 2988 | ||
| 2989 | (defun java-font-lock-syntactic-face-function (state) | ||
| 2990 | (save-excursion | ||
| 2991 | (if (nth 3 state) | ||
| 2992 | ;; Check whether the string is properly terminated. | ||
| 2993 | (let ((nstate (parse-partial-sexp (point) (line-end-position) | ||
| 2994 | nil nil state 'syntax-table))) | ||
| 2995 | (if (and (eolp) (nth 3 nstate)) | ||
| 2996 | ;; We're inside a string, at EOL. The JLS says that: | ||
| 2997 | ;; It is a compile-time error for a line terminator to | ||
| 2998 | ;; appear after the opening " and before the closing | ||
| 2999 | ;; matching ". | ||
| 3000 | font-lock-warning-face | ||
| 3001 | font-lock-string-face)) | ||
| 3002 | (goto-char (nth 8 state)) | ||
| 3003 | (if (looking-at "/\\*\\*") | ||
| 3004 | font-lock-doc-face | ||
| 3005 | font-lock-comment-face)))) | ||
| 3006 | |||
| 2989 | (provide 'font-lock) | 3007 | (provide 'font-lock) |
| 2990 | 3008 | ||
| 2991 | (when (eq font-lock-support-mode 'jit-lock-mode) | 3009 | (when (eq font-lock-support-mode 'jit-lock-mode) |