comparison lisp/font-lock.el @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 3078fd1074e8
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
388 ANCHOR-MATCHER. It might be used to move, before 388 ANCHOR-MATCHER. It might be used to move, before
389 resuming with MATCH-ANCHORED's parent's MATCHER. 389 resuming with MATCH-ANCHORED's parent's MATCHER.
390 390
391 For example, an element of the first form highlights (if not already highlighted): 391 For example, an element of the first form highlights (if not already highlighted):
392 392
393 \"\\\\<foo\\\\>\" Discrete occurrences of \"foo\" in the value 393 \"\\\\\\=<foo\\\\\\=>\" Discrete occurrences of \"foo\" in the value
394 of the variable `font-lock-keyword-face'. 394 of the variable `font-lock-keyword-face'.
395 395
396 (\"fu\\\\(bar\\\\)\" . 1) Substring \"bar\" within all occurrences of 396 (\"fu\\\\(bar\\\\)\" . 1) Substring \"bar\" within all occurrences of
397 \"fubar\" in the value of 397 \"fubar\" in the value of
398 `font-lock-keyword-face'. 398 `font-lock-keyword-face'.
407 (fubar-match 1 fubar-face) The first subexpression within all 407 (fubar-match 1 fubar-face) The first subexpression within all
408 occurrences of whatever the function 408 occurrences of whatever the function
409 `fubar-match' finds and matches in the value 409 `fubar-match' finds and matches in the value
410 of `fubar-face'. 410 of `fubar-face'.
411 411
412 (\"\\\\<anchor\\\\>\" (0 anchor-face) (\"\\\\<item\\\\>\" nil nil (0 item-face))) 412 (\"\\\\\\=<anchor\\\\\\=>\" (0 anchor-face) (\"\\\\\\=<item\\\\\\=>\" nil nil (0 item-face)))
413 -------------- --------------- ------------ --- --- ------------- 413 -------------- --------------- ------------ --- --- -------------
414 | | | | | | 414 | | | | | |
415 MATCHER | ANCHOR-MATCHER | +------+ MATCH-HIGHLIGHT 415 MATCHER | ANCHOR-MATCHER | +------+ MATCH-HIGHLIGHT
416 MATCH-HIGHLIGHT PRE-MATCH-FORM | 416 MATCH-HIGHLIGHT PRE-MATCH-FORM |
417 POST-MATCH-FORM 417 POST-MATCH-FORM
907 907
908 ;; For init-file hooks 908 ;; For init-file hooks
909 ;;;###autoload 909 ;;;###autoload
910 (defun turn-on-font-lock () 910 (defun turn-on-font-lock ()
911 "Unconditionally turn on Font Lock mode." 911 "Unconditionally turn on Font Lock mode."
912 (interactive)
912 (font-lock-mode 1)) 913 (font-lock-mode 1))
913 914
914 ;;;###autoload 915 ;;;###autoload
915 (defun turn-off-font-lock () 916 (defun turn-off-font-lock ()
916 "Unconditionally turn off Font Lock mode." 917 "Unconditionally turn off Font Lock mode."
918 (interactive)
917 (font-lock-mode 0)) 919 (font-lock-mode 0))
918 920
919 ;;; FSF has here: 921 ;;; FSF has here:
920 922
921 ;; support for add-keywords, global-font-lock-mode and 923 ;; support for add-keywords, global-font-lock-mode and
2641 ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for good tables. 2643 ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for good tables.
2642 ("\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)" 2644 ("\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)"
2643 3 (if (match-beginning 2) 'bold 'italic) keep)) 2645 3 (if (match-beginning 2) 'bold 'italic) keep))
2644 "Default expressions to highlight in TeX modes.") 2646 "Default expressions to highlight in TeX modes.")
2645 2647
2646 (defconst ksh-font-lock-keywords (purecopy 2648 (defconst ksh-font-lock-keywords
2647 (list 2649 (list
2648 '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face) 2650 '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face)
2649 '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|foreach\\|in\\|end\\|select\\|while\\|repeat\\|time\\|function\\|until\\|exec\\|command\\|coproc\\|noglob\\|nohup\\|nocorrect\\|source\\|autoload\\|alias\\|unalias\\|export\\|set\\|echo\\|eval\\|cd\\|log\\|compctl\\)\\>" . font-lock-keyword-face) 2651 '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|foreach\\|in\\|end\\|select\\|while\\|repeat\\|time\\|function\\|until\\|exec\\|command\\|coproc\\|noglob\\|nohup\\|nocorrect\\|source\\|autoload\\|alias\\|unalias\\|export\\|set\\|echo\\|eval\\|cd\\|log\\|compctl\\)\\>" . font-lock-keyword-face)
2650 '("\\<\\[\\[.*\\]\\]\\>" . font-lock-type-face) 2652 '("\\<\\[\\[.*\\]\\]\\>" . font-lock-type-face)
2651 '("\$\(.*\)" . font-lock-type-face) 2653 '("\$\(.*\)" . font-lock-type-face)
2652 )) 2654 )
2653 "Additional expressions to highlight in ksh-mode.") 2655 "Additional expressions to highlight in ksh-mode.")
2654 2656
2655 (defconst sh-font-lock-keywords (purecopy 2657 (defconst sh-font-lock-keywords
2656 (list 2658 (list
2657 '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face) 2659 '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face)
2658 '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|in\\|while\\|exec\\|export\\|set\\|echo\\|eval\\|cd\\)\\>" . font-lock-keyword-face) 2660 '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|in\\|while\\|exec\\|export\\|set\\|echo\\|eval\\|cd\\)\\>" . font-lock-keyword-face)
2659 '("\\[.*\\]" . font-lock-type-face) 2661 '("\\[.*\\]" . font-lock-type-face)
2660 '("`.*`" . font-lock-type-face) 2662 '("`.*`" . font-lock-type-face)
2661 )) 2663 )
2662 "Additional expressions to highlight in sh-mode.") 2664 "Additional expressions to highlight in sh-mode.")
2663 2665
2664 2666
2665 ;; Install ourselves: 2667 ;; Install ourselves:
2666 2668