comparison lisp/font-lock.el @ 83307:21eea50897a7

Merged from miles@gnu.org--gnu-2005 (patch 69, 313-319) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-313 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-314 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-315 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-316 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-317 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-318 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-319 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-69 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-347
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 20 May 2005 17:44:36 +0000
parents 8b66fddd72c5 8f934f346603
children 63b7247f4be6
comparison
equal deleted inserted replaced
83306:8b66fddd72c5 83307:21eea50897a7
1965 1965
1966 ;; Lisp. 1966 ;; Lisp.
1967 1967
1968 (defconst lisp-font-lock-keywords-1 1968 (defconst lisp-font-lock-keywords-1
1969 (eval-when-compile 1969 (eval-when-compile
1970 (list 1970 `(;; Definitions.
1971 ;; 1971 (,(concat "(\\(def\\("
1972 ;; Definitions. 1972 ;; Function declarations.
1973 (list (concat "(\\(def\\(" 1973 "\\(advice\\|varalias\\|alias\\|generic\\|macro\\*?\\|method\\|"
1974 ;; Function declarations. 1974 "setf\\|subst\\*?\\|un\\*?\\|"
1975 "\\(advice\\|varalias\\|alias\\|generic\\|macro\\*?\\|method\\|" 1975 "ine-\\(condition\\|\\(?:derived\\|minor\\|generic\\)-mode\\|"
1976 "setf\\|subst\\*?\\|un\\*?\\|" 1976 "method-combination\\|setf-expander\\|skeleton\\|widget\\|"
1977 "ine-\\(condition\\|\\(?:derived\\|minor\\|generic\\)-mode\\|" 1977 "function\\|\\(compiler\\|modify\\|symbol\\)-macro\\)\\)\\|"
1978 "method-combination\\|setf-expander\\|skeleton\\|widget\\|" 1978 ;; Variable declarations.
1979 "function\\|\\(compiler\\|modify\\|symbol\\)-macro\\)\\)\\|" 1979 "\\(const\\(ant\\)?\\|custom\\|face\\|parameter\\|var\\)\\|"
1980 ;; Variable declarations. 1980 ;; Structure declarations.
1981 "\\(const\\(ant\\)?\\|custom\\|face\\|parameter\\|var\\)\\|" 1981 "\\(class\\|group\\|theme\\|package\\|struct\\|type\\)"
1982 ;; Structure declarations. 1982 "\\)\\)\\>"
1983 "\\(class\\|group\\|theme\\|package\\|struct\\|type\\)" 1983 ;; Any whitespace and defined object.
1984 "\\)\\)\\>" 1984 "[ \t'\(]*"
1985 ;; Any whitespace and defined object. 1985 "\\(setf[ \t]+\\sw+)\\|\\sw+\\)?")
1986 "[ \t'\(]*" 1986 (1 font-lock-keyword-face)
1987 "\\(setf[ \t]+\\sw+)\\|\\sw+\\)?") 1987 (9 (cond ((match-beginning 3) font-lock-function-name-face)
1988 '(1 font-lock-keyword-face) 1988 ((match-beginning 6) font-lock-variable-name-face)
1989 '(9 (cond ((match-beginning 3) font-lock-function-name-face) 1989 (t font-lock-type-face))
1990 ((match-beginning 6) font-lock-variable-name-face) 1990 nil t))
1991 (t font-lock-type-face)) 1991 ;; Emacs Lisp autoload cookies.
1992 nil t)) 1992 ("^;;;###\\(autoload\\)" 1 font-lock-warning-face prepend)
1993 ;; 1993 ;; Regexp negated char group.
1994 ;; Emacs Lisp autoload cookies. 1994 ("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)))
1995 '("^;;;###\\(autoload\\)" 1 font-lock-warning-face prepend)
1996 ))
1997 "Subdued level highlighting for Lisp modes.") 1995 "Subdued level highlighting for Lisp modes.")
1998 1996
1999 (defconst lisp-font-lock-keywords-2 1997 (defconst lisp-font-lock-keywords-2
2000 (append lisp-font-lock-keywords-1 1998 (append lisp-font-lock-keywords-1
2001 (eval-when-compile 1999 (eval-when-compile
2002 (list 2000 `(;; Control structures. Emacs Lisp forms.
2003 ;; 2001 (,(concat
2004 ;; Control structures. Emacs Lisp forms. 2002 "(" (regexp-opt
2005 (cons (concat 2003 '("cond" "if" "while" "let" "let*"
2006 "(" (regexp-opt 2004 "prog" "progn" "progv" "prog1" "prog2" "prog*"
2007 '("cond" "if" "while" "let" "let*" 2005 "inline" "lambda" "save-restriction" "save-excursion"
2008 "prog" "progn" "progv" "prog1" "prog2" "prog*" 2006 "save-window-excursion" "save-selected-window"
2009 "inline" "lambda" "save-restriction" "save-excursion" 2007 "save-match-data" "save-current-buffer" "unwind-protect"
2010 "save-window-excursion" "save-selected-window" 2008 "condition-case" "track-mouse"
2011 "save-match-data" "save-current-buffer" "unwind-protect" 2009 "eval-after-load" "eval-and-compile" "eval-when-compile"
2012 "condition-case" "track-mouse" 2010 "eval-when"
2013 "eval-after-load" "eval-and-compile" "eval-when-compile" 2011 "with-category-table"
2014 "eval-when" 2012 "with-current-buffer" "with-electric-help"
2015 "with-category-table" 2013 "with-local-quit" "with-no-warnings"
2016 "with-current-buffer" "with-electric-help" 2014 "with-output-to-string" "with-output-to-temp-buffer"
2017 "with-local-quit" "with-no-warnings" 2015 "with-selected-window" "with-selected-frame" "with-syntax-table"
2018 "with-output-to-string" "with-output-to-temp-buffer" 2016 "with-temp-buffer" "with-temp-file" "with-temp-message"
2019 "with-selected-window" "with-selected-frame" "with-syntax-table" 2017 "with-timeout" "with-timeout-handler") t)
2020 "with-temp-buffer" "with-temp-file" "with-temp-message" 2018 "\\>")
2021 "with-timeout" "with-timeout-handler") t) 2019 . 1)
2022 "\\>") 2020 ;; Control structures. Common Lisp forms.
2023 1) 2021 (,(concat
2024 ;; 2022 "(" (regexp-opt
2025 ;; Control structures. Common Lisp forms. 2023 '("when" "unless" "case" "ecase" "typecase" "etypecase"
2026 (cons (concat 2024 "ccase" "ctypecase" "handler-case" "handler-bind"
2027 "(" (regexp-opt 2025 "restart-bind" "restart-case" "in-package"
2028 '("when" "unless" "case" "ecase" "typecase" "etypecase" 2026 "break" "ignore-errors"
2029 "ccase" "ctypecase" "handler-case" "handler-bind" 2027 "loop" "do" "do*" "dotimes" "dolist" "the" "locally"
2030 "restart-bind" "restart-case" "in-package" 2028 "proclaim" "declaim" "declare" "symbol-macrolet"
2031 "break" "ignore-errors" 2029 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
2032 "loop" "do" "do*" "dotimes" "dolist" "the" "locally" 2030 "destructuring-bind" "macrolet" "tagbody" "block" "go"
2033 "proclaim" "declaim" "declare" "symbol-macrolet" 2031 "multiple-value-bind" "multiple-value-prog1"
2034 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" 2032 "return" "return-from"
2035 "destructuring-bind" "macrolet" "tagbody" "block" "go" 2033 "with-accessors" "with-compilation-unit"
2036 "multiple-value-bind" "multiple-value-prog1" 2034 "with-condition-restarts" "with-hash-table-iterator"
2037 "return" "return-from" 2035 "with-input-from-string" "with-open-file"
2038 "with-accessors" "with-compilation-unit" 2036 "with-open-stream" "with-output-to-string"
2039 "with-condition-restarts" "with-hash-table-iterator" 2037 "with-package-iterator" "with-simple-restart"
2040 "with-input-from-string" "with-open-file" 2038 "with-slots" "with-standard-io-syntax") t)
2041 "with-open-stream" "with-output-to-string" 2039 "\\>")
2042 "with-package-iterator" "with-simple-restart" 2040 . 1)
2043 "with-slots" "with-standard-io-syntax") t) 2041 ;; Exit/Feature symbols as constants.
2044 "\\>") 2042 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\>"
2045 1) 2043 "[ \t']*\\(\\sw+\\)?")
2046 ;; 2044 (1 font-lock-keyword-face)
2047 ;; Exit/Feature symbols as constants. 2045 (2 font-lock-constant-face nil t))
2048 (list (concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\>" 2046 ;; Erroneous structures.
2049 "[ \t']*\\(\\sw+\\)?") 2047 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
2050 '(1 font-lock-keyword-face) 2048 ;; Words inside \\[] tend to be for `substitute-command-keys'.
2051 '(2 font-lock-constant-face nil t)) 2049 ("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend)
2052 ;; 2050 ;; Words inside `' tend to be symbol names.
2053 ;; Erroneous structures. 2051 ("`\\(\\sw\\sw+\\)'" 1 font-lock-constant-face prepend)
2054 '("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face) 2052 ;; Constant values.
2055 ;; 2053 ("\\<:\\sw+\\>" 0 font-lock-builtin-face)
2056 ;; Words inside \\[] tend to be for `substitute-command-keys'. 2054 ;; ELisp and CLisp `&' keywords as types.
2057 '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend) 2055 ("\\&\\sw+\\>" . font-lock-type-face)
2058 ;; 2056 ;; Make regexp grouping constructs bold, so they stand out, but only in strings.
2059 ;; Words inside `' tend to be symbol names. 2057 ((lambda (bound)
2060 '("`\\(\\sw\\sw+\\)'" 1 font-lock-constant-face prepend) 2058 (if (re-search-forward "\\([\\][\\]\\)\\([(|)]\\)\\(\\?:\\)?" bound)
2061 ;; 2059 (let ((face (get-text-property (1- (point)) 'face)))
2062 ;; Constant values. 2060 (if (listp face)
2063 '("\\<:\\sw+\\>" 0 font-lock-builtin-face) 2061 (memq 'font-lock-string-face face)
2064 ;; 2062 (eq 'font-lock-string-face face)))))
2065 ;; ELisp and CLisp `&' keywords as types. 2063 (1 font-lock-comment-face prepend) ; Should we introduce a lowlight face for this?
2066 '("\\&\\sw+\\>" . font-lock-type-face) 2064 ; Ideally that would retain the color, dimmed 50%.
2067 ;; 2065 (2 'bold prepend)
2066 (3 font-lock-type-face prepend t))
2067 ;; Underline innermost grouping, so that you can more easily see what belongs together.
2068 ;; 2005-05-12: Font-lock can go into an unbreakable endless loop on this -- something's broken.
2069 ;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]"
2070 ;;1 'underline prepend)
2068 ;;; This is too general -- rms. 2071 ;;; This is too general -- rms.
2069 ;;; A user complained that he has functions whose names start with `do' 2072 ;;; A user complained that he has functions whose names start with `do'
2070 ;;; and that they get the wrong color. 2073 ;;; and that they get the wrong color.
2071 ;;; ;; CL `with-' and `do-' constructs 2074 ;;; ;; CL `with-' and `do-' constructs
2072 ;;; '("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face) 2075 ;;; ("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
2073 ))) 2076 )))
2074 "Gaudy level highlighting for Lisp modes.") 2077 "Gaudy level highlighting for Lisp modes.")
2075 2078
2076 (defvar lisp-font-lock-keywords lisp-font-lock-keywords-1 2079 (defvar lisp-font-lock-keywords lisp-font-lock-keywords-1
2077 "Default expressions to highlight in Lisp modes.") 2080 "Default expressions to highlight in Lisp modes.")