comparison lisp/font-lock.el @ 90192:173dee4e2611

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-61 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 353-357) - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 09 Jun 2005 07:13:03 +0000
parents 01137c1fdbe9 ad41fcdb0642
children b7da78284d4c
comparison
equal deleted inserted replaced
90191:c766b49f5bbd 90192:173dee4e2611
689 689
690 For example: 690 For example:
691 691
692 (add-hook 'c-mode-hook 692 (add-hook 'c-mode-hook
693 (lambda () 693 (lambda ()
694 (font-lock-add-keywords 'c-mode 694 (font-lock-add-keywords nil
695 '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend) 695 '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend)
696 (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" . 696 (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" .
697 font-lock-keyword-face))))) 697 font-lock-keyword-face)))))
698 698
699 The above procedure may fail to add keywords to derived modes if 699 The above procedure may fail to add keywords to derived modes if
903 ;; Prepare for jit-lock 903 ;; Prepare for jit-lock
904 (remove-hook 'after-change-functions 904 (remove-hook 'after-change-functions
905 'font-lock-after-change-function t) 905 'font-lock-after-change-function t)
906 (set (make-local-variable 'font-lock-fontify-buffer-function) 906 (set (make-local-variable 'font-lock-fontify-buffer-function)
907 'jit-lock-refontify) 907 'jit-lock-refontify)
908 ;; Don't fontify eagerly (and don't abort is the buffer is large). 908 ;; Don't fontify eagerly (and don't abort if the buffer is large).
909 (set (make-local-variable 'font-lock-fontified) t) 909 (set (make-local-variable 'font-lock-fontified) t)
910 ;; Use jit-lock. 910 ;; Use jit-lock.
911 (jit-lock-register 'font-lock-fontify-region 911 (jit-lock-register 'font-lock-fontify-region
912 (not font-lock-keywords-only)))))) 912 (not font-lock-keywords-only))))))
913 913
1822 :group 'font-lock-highlighting-faces) 1822 :group 'font-lock-highlighting-faces)
1823 1823
1824 (defface font-lock-preprocessor-face 1824 (defface font-lock-preprocessor-face
1825 '((t :inherit font-lock-builtin-face)) 1825 '((t :inherit font-lock-builtin-face))
1826 "Font Lock mode face used to highlight preprocessor directives." 1826 "Font Lock mode face used to highlight preprocessor directives."
1827 :group 'font-lock-highlighting-faces)
1828
1829 (defface font-lock-regexp-backslash
1830 '((((class color) (min-colors 16)) :inherit escape-glyph)
1831 (t :inherit bold))
1832 "Font Lock mode face used to highlight a backslash in Lisp regexps."
1833 :group 'font-lock-highlighting-faces)
1834
1835 (defface font-lock-regexp-backslash-construct
1836 '((t :inherit bold))
1837 "Font Lock mode face used to highlight `\' constructs in Lisp regexps."
1827 :group 'font-lock-highlighting-faces) 1838 :group 'font-lock-highlighting-faces)
1828 1839
1829 ;;; End of Colour etc. support. 1840 ;;; End of Colour etc. support.
1830 1841
1831 ;;; Menu support. 1842 ;;; Menu support.
2018 (append lisp-font-lock-keywords-1 2029 (append lisp-font-lock-keywords-1
2019 (eval-when-compile 2030 (eval-when-compile
2020 `(;; Control structures. Emacs Lisp forms. 2031 `(;; Control structures. Emacs Lisp forms.
2021 (,(concat 2032 (,(concat
2022 "(" (regexp-opt 2033 "(" (regexp-opt
2023 '("cond" "if" "while" "let" "let*" 2034 '("cond" "if" "while" "while-no-input" "let" "let*"
2024 "prog" "progn" "progv" "prog1" "prog2" "prog*" 2035 "prog" "progn" "progv" "prog1" "prog2" "prog*"
2025 "inline" "lambda" "save-restriction" "save-excursion" 2036 "inline" "lambda" "save-restriction" "save-excursion"
2026 "save-window-excursion" "save-selected-window" 2037 "save-window-excursion" "save-selected-window"
2027 "save-match-data" "save-current-buffer" "unwind-protect" 2038 "save-match-data" "save-current-buffer" "unwind-protect"
2028 "condition-case" "track-mouse" 2039 "condition-case" "track-mouse"
2074 ;; ELisp and CLisp `&' keywords as types. 2085 ;; ELisp and CLisp `&' keywords as types.
2075 ("\\&\\sw+\\>" . font-lock-type-face) 2086 ("\\&\\sw+\\>" . font-lock-type-face)
2076 ;; Make regexp grouping constructs bold, so they stand out, but only 2087 ;; Make regexp grouping constructs bold, so they stand out, but only
2077 ;; in strings. 2088 ;; in strings.
2078 ((lambda (bound) 2089 ((lambda (bound)
2079 (if (re-search-forward "\\(\\\\\\\\\\)\\([(|)]\\)\\(\\?:\\)?" bound t) 2090 (if (re-search-forward "\\(\\\\\\\\\\)\\((\\(?:?:\\)?\\|[|)]\\)" bound t)
2080 (let ((face (get-text-property (1- (point)) 'face))) 2091 (let ((face (get-text-property (1- (point)) 'face)))
2081 (if (listp face) 2092 (if (listp face)
2082 (memq 'font-lock-string-face face) 2093 (memq 'font-lock-string-face face)
2083 (eq 'font-lock-string-face face))))) 2094 (eq 'font-lock-string-face face)))))
2084 ;; Should we introduce a lowlight face for this? 2095 (1 'font-lock-regexp-backslash prepend)
2085 ;; Ideally that would retain the color, dimmed. 2096 (2 'font-lock-regexp-backslash-construct prepend))
2086 (1 font-lock-comment-face prepend) 2097
2087 (2 'bold prepend)
2088 (3 font-lock-type-face prepend t))
2089 ;; Underline innermost grouping, so that you can more easily see what 2098 ;; Underline innermost grouping, so that you can more easily see what
2090 ;; belongs together. 2005-05-12: Font-lock can go into an 2099 ;; belongs together. 2005-05-12: Font-lock can go into an
2091 ;; unbreakable endless loop on this -- something's broken. 2100 ;; unbreakable endless loop on this -- something's broken.
2092 ;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]" 2101 ;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]"
2093 ;;1 'underline prepend) 2102 ;;1 'underline prepend)