Mercurial > emacs
comparison lisp/font-lock.el @ 4239:e8cf7a7d0102
(font-lock-after-change-function):
Scan for comments and strings from beg of line.
(c-font-lock-keywords-1): Recognize &, like *, before fn name.
(perl-font-lock-keywords): Put digit 1 into function-name-face items.
Allow whitespace before the open-brace.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Jul 1993 05:10:00 +0000 |
parents | 24f3ca095be9 |
children | 2d8f7239f2ca |
comparison
equal
deleted
inserted
replaced
4238:6a22eb586080 | 4239:e8cf7a7d0102 |
---|---|
243 (setq font-lock-cache-position nil)) | 243 (setq font-lock-cache-position nil)) |
244 ;; Rescan till end of line. yes! | 244 ;; Rescan till end of line. yes! |
245 (goto-char end) | 245 (goto-char end) |
246 (end-of-line) | 246 (end-of-line) |
247 (setq end (point)) | 247 (setq end (point)) |
248 ;; First scan for strings and comments. | |
249 (font-lock-fontify-region beg (1+ end)) | |
250 (goto-char beg) | 248 (goto-char beg) |
251 (beginning-of-line) | 249 (beginning-of-line) |
252 (setq beg (point)) | 250 (setq beg (point)) |
251 ;; First scan for strings and comments. | |
252 ;; Must scan from line start in case of | |
253 ;; inserting space into `intfoo () {}'. | |
254 (font-lock-fontify-region beg (1+ end)) | |
253 ;; Now scan for keywords. | 255 ;; Now scan for keywords. |
254 (font-lock-hack-keywords beg end)))) | 256 (font-lock-hack-keywords beg end)))) |
255 | 257 |
256 ;;; Fontifying arbitrary patterns | 258 ;;; Fontifying arbitrary patterns |
257 | 259 |
483 ;; fontify the names of functions being defined. | 485 ;; fontify the names of functions being defined. |
484 (list (concat | 486 (list (concat |
485 "^\\(" ctoken "[ \t]+\\)?" ; type specs; there can be no | 487 "^\\(" ctoken "[ \t]+\\)?" ; type specs; there can be no |
486 "\\(" ctoken "[ \t]+\\)?" ; more than 3 tokens, right? | 488 "\\(" ctoken "[ \t]+\\)?" ; more than 3 tokens, right? |
487 "\\(" ctoken "[ \t]+\\)?" | 489 "\\(" ctoken "[ \t]+\\)?" |
488 "\\(\\*+[ \t]*\\)?" ; pointer | 490 "\\([*&]+[ \t]*\\)?" ; pointer |
489 "\\(" ctoken "\\)[ \t]*(") ; name | 491 "\\(" ctoken "\\)[ \t]*(") ; name |
490 5 'font-lock-function-name-face) | 492 5 'font-lock-function-name-face) |
491 ;; | 493 ;; |
492 ;; | 494 ;; |
493 ;; Fontify structure names (in structure definition form). | 495 ;; Fontify structure names (in structure definition form). |
557 "\\)[ \n\t;(]") 1) | 559 "\\)[ \n\t;(]") 1) |
558 (mapconcat 'identity | 560 (mapconcat 'identity |
559 '("#endif" "#else" "#ifdef" "#ifndef" "#if" "#include" | 561 '("#endif" "#else" "#ifdef" "#ifndef" "#if" "#include" |
560 "#define" "#undef") | 562 "#define" "#undef") |
561 "\\|") | 563 "\\|") |
562 '("^[ \n\t]*sub[ \t]+\\([^ \t{]+\\)\\{" . font-lock-function-name-face) | 564 '("^[ \n\t]*sub[ \t]+\\([^ \t{]+\\)[ \t]*[{]" 1 font-lock-function-name-face) |
563 '("[ \n\t{]*\\(eval\\)[ \n\t(;]" . font-lock-function-name-face) | 565 '("[ \n\t{]*\\(eval\\)[ \n\t(;]" 1 font-lock-function-name-face) |
564 '("\\(--- .* ---\\|=== .* ===\\)" . font-lock-doc-string-face) | 566 '("\\(--- .* ---\\|=== .* ===\\)" . font-lock-doc-string-face) |
565 ) | 567 ) |
566 "Additional expressions to highlight in Perl mode.") | 568 "Additional expressions to highlight in Perl mode.") |
567 | 569 |
568 (defvar tex-font-lock-keywords | 570 (defvar tex-font-lock-keywords |