aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-10-08 10:57:18 -0400
committerStefan Monnier2013-10-08 10:57:18 -0400
commit06286513730d013c2033d1dae892349e5eec98d9 (patch)
treecdbd287904e3860d4fe8c3f2278290ec9ba50a78
parentecab13d4aa458544c604ece77e2ecdf0b9910649 (diff)
downloademacs-06286513730d013c2033d1dae892349e5eec98d9.tar.gz
emacs-06286513730d013c2033d1dae892349e5eec98d9.zip
* lisp/emacs-lisp/lisp-mode.el: Font-lock cl-lib constructs.
(lisp-el-font-lock-keywords, lisp-el-font-lock-keywords-1) (lisp-el-font-lock-keywords-2, lisp-cl-font-lock-keywords) (lisp-cl-font-lock-keywords-1, lisp-cl-font-lock-keywords-2): New constants. (lisp-mode-variables): New `elisp' argument. (emacs-lisp-mode): Use it. * lisp/font-lock.el (lisp-font-lock-keywords, lisp-font-lock-keywords-1) (lisp-font-lock-keywords-2): Move to lisp-mode.el.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/emacs-lisp/lisp-mode.el250
-rw-r--r--lisp/font-lock.el125
3 files changed, 255 insertions, 130 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f9161dc29d0..74ca0a23c97 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,15 @@
12013-10-08 Stefan Monnier <monnier@iro.umontreal.ca> 12013-10-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/lisp-mode.el: Font-lock cl-lib constructs.
4 (lisp-el-font-lock-keywords, lisp-el-font-lock-keywords-1)
5 (lisp-el-font-lock-keywords-2, lisp-cl-font-lock-keywords)
6 (lisp-cl-font-lock-keywords-1, lisp-cl-font-lock-keywords-2):
7 New constants.
8 (lisp-mode-variables): New `elisp' argument.
9 (emacs-lisp-mode): Use it.
10 * font-lock.el (lisp-font-lock-keywords, lisp-font-lock-keywords-1)
11 (lisp-font-lock-keywords-2): Move to lisp-mode.el.
12
3 * indent.el: Use lexical-binding. 13 * indent.el: Use lexical-binding.
4 (indent-region): Add progress reporter. 14 (indent-region): Add progress reporter.
5 (tab-stop-list): Make it implicitly extend to infinity by repeating the 15 (tab-stop-list): Make it implicitly extend to infinity by repeating the
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index f1705cbc9ec..0b82efab122 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -153,6 +153,242 @@ It has `lisp-mode-abbrev-table' as its parent."
153(defvar lisp-doc-string-elt-property 'doc-string-elt 153(defvar lisp-doc-string-elt-property 'doc-string-elt
154 "The symbol property that holds the docstring position info.") 154 "The symbol property that holds the docstring position info.")
155 155
156
157;;;; Font-lock support.
158
159(pcase-let
160 ((`(,vdefs ,tdefs
161 ,el-defs-re ,cl-defs-re
162 ,el-kws-re ,cl-kws-re
163 ,el-errs-re ,cl-errs-re)
164 (eval-when-compile
165 (let ((lisp-fdefs '("defmacro" "defsubst" "defun"))
166 (lisp-vdefs '("defvar"))
167 (lisp-kw '("cond" "if" "while" "let" "let*" "progn" "prog1"
168 "prog2" "lambda" "unwind-protect" "condition-case"
169 "when" "unless" "with-output-to-string"
170 "ignore-errors" "dotimes" "dolist" "declare"))
171 (lisp-errs '("warn" "error" "signal"))
172 ;; Elisp constructs. FIXME: update dynamically from obarray.
173 (el-fdefs '("defadvice" "defalias"
174 "define-derived-mode" "define-minor-mode"
175 "define-generic-mode" "define-global-minor-mode"
176 "define-globalized-minor-mode" "define-skeleton"
177 "define-widget"))
178 (el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local"
179 "defface"))
180 (el-tdefs '("defgroup" "deftheme"))
181 (el-kw '("while-no-input" "letrec" "pcase" "pcase-let"
182 "pcase-let*" "save-restriction" "save-excursion"
183 "save-selected-window"
184 ;; "eval-after-load" "eval-next-after-load"
185 "save-window-excursion" "save-current-buffer"
186 "save-match-data" "combine-after-change-calls"
187 "condition-case-unless-debug" "track-mouse"
188 "eval-and-compile" "eval-when-compile" "with-case-table"
189 "with-category-table" "with-coding-priority"
190 "with-current-buffer" "with-demoted-errors"
191 "with-electric-help" "with-eval-after-load"
192 "with-local-quit" "with-no-warnings"
193 "with-output-to-temp-buffer" "with-selected-window"
194 "with-selected-frame" "with-silent-modifications"
195 "with-syntax-table" "with-temp-buffer" "with-temp-file"
196 "with-temp-message" "with-timeout"
197 "with-timeout-handler"))
198 (el-errs '("user-error"))
199 ;; Common-Lisp constructs supported by EIEIO. FIXME: namespace.
200 (eieio-fdefs '("defgeneric" "defmethod"))
201 (eieio-tdefs '("defclass"))
202 (eieio-kw '("with-slots"))
203 ;; Common-Lisp constructs supported by cl-lib.
204 (cl-lib-fdefs '("defmacro" "defsubst" "defun"))
205 (cl-lib-tdefs '("defstruct" "deftype"))
206 (cl-lib-kw '("progv" "eval-when" "case" "ecase" "typecase"
207 "etypecase" "ccase" "ctypecase" "loop" "do" "do*"
208 "the" "locally" "proclaim" "declaim" "letf" "go"
209 ;; "lexical-let" "lexical-let*"
210 "symbol-macrolet" "flet" "destructuring-bind"
211 "labels" "macrolet" "tagbody" "multiple-value-bind"
212 "block" "return" "return-from"))
213 (cl-lib-errs '("assert" "check-type"))
214 ;; Common-Lisp constructs not supported by cl-lib.
215 (cl-fdefs '("defsetf" "define-method-combination"
216 "define-condition" "define-setf-expander"
217 ;; "define-function"??
218 "define-compiler-macro" "define-modify-macro"))
219 (cl-vdefs '("define-symbol-macro" "defconstant" "defparameter"))
220 (cl-tdefs '("defpackage" "defstruct" "deftype"))
221 (cl-kw '("prog" "prog*" "handler-case" "handler-bind"
222 "in-package" "restart-case" ;; "inline"
223 "restart-bind" "break" "multiple-value-prog1"
224 "compiler-let" "with-accessors" "with-compilation-unit"
225 "with-condition-restarts" "with-hash-table-iterator"
226 "with-input-from-string" "with-open-file"
227 "with-open-stream" "with-package-iterator"
228 "with-simple-restart" "with-standard-io-syntax"))
229 (cl-errs '("abort" "cerror")))
230
231 (list (append lisp-vdefs el-vdefs cl-vdefs)
232 (append el-tdefs eieio-tdefs cl-tdefs cl-lib-tdefs
233 (mapcar (lambda (s) (concat "cl-" s)) cl-lib-tdefs))
234
235 ;; Elisp and Common Lisp definers.
236 (regexp-opt (append lisp-fdefs lisp-vdefs
237 el-fdefs el-vdefs el-tdefs
238 (mapcar (lambda (s) (concat "cl-" s))
239 (append cl-lib-fdefs cl-lib-tdefs))
240 eieio-fdefs eieio-tdefs)
241 t)
242 (regexp-opt (append lisp-fdefs lisp-vdefs
243 cl-lib-fdefs cl-lib-tdefs
244 eieio-fdefs eieio-tdefs
245 cl-fdefs cl-vdefs cl-tdefs)
246 t)
247
248 ;; Elisp and Common Lisp keywords.
249 (regexp-opt (append
250 lisp-kw el-kw eieio-kw
251 (cons "go" (mapcar (lambda (s) (concat "cl-" s))
252 (remove "go" cl-lib-kw))))
253 t)
254 (regexp-opt (append lisp-kw el-kw eieio-kw
255 (cons "go" (mapcar (lambda (s) (concat "cl-" s))
256 (remove "go" cl-kw))))
257 t)
258
259 ;; Elisp and Common Lisp "errors".
260 (regexp-opt (append (mapcar (lambda (s) (concat "cl-" s))
261 cl-lib-errs)
262 lisp-errs el-errs)
263 t)
264 (regexp-opt (append lisp-errs cl-lib-errs cl-errs) t))))))
265
266 (dolist (v vdefs)
267 (put (intern v) 'lisp-define-type 'var))
268 (dolist (v tdefs)
269 (put (intern v) 'lisp-define-type 'type))
270
271 (define-obsolete-variable-alias 'lisp-font-lock-keywords-1
272 'lisp-el-font-lock-keywords-1 "24.4")
273 (defconst lisp-el-font-lock-keywords-1
274 `( ;; Definitions.
275 (,(concat "(" el-defs-re "\\_>"
276 ;; Any whitespace and defined object.
277 "[ \t'\(]*"
278 "\\(\\(?:\\sw\\|\\s_\\)+\\)?")
279 (1 font-lock-keyword-face)
280 (2 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type)))
281 (cond ((eq type 'var) font-lock-variable-name-face)
282 ((eq type 'type) font-lock-type-face)
283 (t font-lock-function-name-face)))
284 nil t))
285 ;; Emacs Lisp autoload cookies. Supports the slightly different
286 ;; forms used by mh-e, calendar, etc.
287 ("^;;;###\\([-a-z]*autoload\\)" 1 font-lock-warning-face prepend))
288 "Subdued level highlighting for Emacs Lisp mode.")
289
290 (defconst lisp-cl-font-lock-keywords-1
291 `( ;; Definitions.
292 (,(concat "(" cl-defs-re "\\_>"
293 ;; Any whitespace and defined object.
294 "[ \t'\(]*"
295 "\\(setf[ \t]+\\(?:\\sw\\|\\s_\\)+\\|\\(?:\\sw\\|\\s_\\)+\\)?")
296 (1 font-lock-keyword-face)
297 (2 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type)))
298 (cond ((eq type 'var) font-lock-variable-name-face)
299 ((eq type 'type) font-lock-type-face)
300 (t font-lock-function-name-face)))
301 nil t)))
302 "Subdued level highlighting for Lisp modes.")
303
304 (define-obsolete-variable-alias 'lisp-font-lock-keywords-2
305 'lisp-el-font-lock-keywords-2 "24.4")
306 (defconst lisp-el-font-lock-keywords-2
307 (append
308 lisp-el-font-lock-keywords-1
309 `( ;; Regexp negated char group.
310 ("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)
311 ;; Control structures. Common Lisp forms.
312 (,(concat "(" el-kws-re "\\_>") . 1)
313 ;; Exit/Feature symbols as constants.
314 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\_>"
315 "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?")
316 (1 font-lock-keyword-face)
317 (2 font-lock-constant-face nil t))
318 ;; Erroneous structures.
319 (,(concat "(" el-errs-re "\\_>")
320 (1 font-lock-warning-face))
321 ;; Words inside \\[] tend to be for `substitute-command-keys'.
322 ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]"
323 (1 font-lock-constant-face prepend))
324 ;; Words inside `' tend to be symbol names.
325 ("`\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)'"
326 (1 font-lock-constant-face prepend))
327 ;; Constant values.
328 ("\\_<:\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face)
329 ;; ELisp and CLisp `&' keywords as types.
330 ("\\_<\\&\\(?:\\sw\\|\\s_\\)+\\_>" . font-lock-type-face)
331 ;; ELisp regexp grouping constructs
332 (,(lambda (bound)
333 (catch 'found
334 ;; The following loop is needed to continue searching after matches
335 ;; that do not occur in strings. The associated regexp matches one
336 ;; of `\\\\' `\\(' `\\(?:' `\\|' `\\)'. `\\\\' has been included to
337 ;; avoid highlighting, for example, `\\(' in `\\\\('.
338 (while (re-search-forward "\\(\\\\\\\\\\)\\(?:\\(\\\\\\\\\\)\\|\\((\\(?:\\?[0-9]*:\\)?\\|[|)]\\)\\)" bound t)
339 (unless (match-beginning 2)
340 (let ((face (get-text-property (1- (point)) 'face)))
341 (when (or (and (listp face)
342 (memq 'font-lock-string-face face))
343 (eq 'font-lock-string-face face))
344 (throw 'found t)))))))
345 (1 'font-lock-regexp-grouping-backslash prepend)
346 (3 'font-lock-regexp-grouping-construct prepend))
347 ;; This is too general -- rms.
348 ;; A user complained that he has functions whose names start with `do'
349 ;; and that they get the wrong color.
350 ;; ;; CL `with-' and `do-' constructs
351 ;;("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
352 ))
353 "Gaudy level highlighting for Emacs Lisp mode.")
354
355 (defconst lisp-cl-font-lock-keywords-2
356 (append
357 lisp-cl-font-lock-keywords-1
358 `( ;; Regexp negated char group.
359 ("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)
360 ;; Control structures. Common Lisp forms.
361 (,(concat "(" cl-kws-re "\\_>") . 1)
362 ;; Exit/Feature symbols as constants.
363 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\_>"
364 "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?")
365 (1 font-lock-keyword-face)
366 (2 font-lock-constant-face nil t))
367 ;; Erroneous structures.
368 (,(concat "(" cl-errs-re "\\_>")
369 (1 font-lock-warning-face))
370 ;; Words inside `' tend to be symbol names.
371 ("`\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)'"
372 (1 font-lock-constant-face prepend))
373 ;; Constant values.
374 ("\\_<:\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face)
375 ;; ELisp and CLisp `&' keywords as types.
376 ("\\_<\\&\\(?:\\sw\\|\\s_\\)+\\_>" . font-lock-type-face)
377 ;; This is too general -- rms.
378 ;; A user complained that he has functions whose names start with `do'
379 ;; and that they get the wrong color.
380 ;; ;; CL `with-' and `do-' constructs
381 ;;("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
382 ))
383 "Gaudy level highlighting for Lisp modes."))
384
385(define-obsolete-variable-alias 'lisp-font-lock-keywords
386 'lisp-el-font-lock-keywords "24.4")
387(defvar lisp-el-font-lock-keywords lisp-el-font-lock-keywords-1
388 "Default expressions to highlight in Emacs Lisp mode.")
389(defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1
390 "Default expressions to highlight in Lisp modes.")
391
156(defun lisp-font-lock-syntactic-face-function (state) 392(defun lisp-font-lock-syntactic-face-function (state)
157 (if (nth 3 state) 393 (if (nth 3 state)
158 ;; This might be a (doc)string or a |...| symbol. 394 ;; This might be a (doc)string or a |...| symbol.
@@ -190,7 +426,8 @@ It has `lisp-mode-abbrev-table' as its parent."
190 font-lock-string-face)))) 426 font-lock-string-face))))
191 font-lock-comment-face)) 427 font-lock-comment-face))
192 428
193(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive) 429(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive
430 elisp)
194 "Common initialization routine for lisp modes. 431 "Common initialization routine for lisp modes.
195The LISP-SYNTAX argument is used by code in inf-lisp.el and is 432The LISP-SYNTAX argument is used by code in inf-lisp.el and is
196\(uselessly) passed from pp.el, chistory.el, gnus-kill.el and 433\(uselessly) passed from pp.el, chistory.el, gnus-kill.el and
@@ -227,9 +464,12 @@ font-lock keywords will not be case sensitive."
227 (setq-local multibyte-syntax-as-symbol t) 464 (setq-local multibyte-syntax-as-symbol t)
228 (setq-local syntax-begin-function 'beginning-of-defun) 465 (setq-local syntax-begin-function 'beginning-of-defun)
229 (setq font-lock-defaults 466 (setq font-lock-defaults
230 `((lisp-font-lock-keywords 467 `(,(if elisp '(lisp-el-font-lock-keywords
231 lisp-font-lock-keywords-1 468 lisp-el-font-lock-keywords-1
232 lisp-font-lock-keywords-2) 469 lisp-el-font-lock-keywords-2)
470 '(lisp-cl-font-lock-keywords
471 lisp-cl-font-lock-keywords-1
472 lisp-cl-font-lock-keywords-2))
233 nil ,keywords-case-insensitive nil nil 473 nil ,keywords-case-insensitive nil nil
234 (font-lock-mark-block-function . mark-defun) 474 (font-lock-mark-block-function . mark-defun)
235 (font-lock-syntactic-face-function 475 (font-lock-syntactic-face-function
@@ -466,7 +706,7 @@ Blank lines separate paragraphs. Semicolons start comments.
466Entry to this mode calls the value of `emacs-lisp-mode-hook' 706Entry to this mode calls the value of `emacs-lisp-mode-hook'
467if that value is non-nil." 707if that value is non-nil."
468 :group 'lisp 708 :group 'lisp
469 (lisp-mode-variables) 709 (lisp-mode-variables nil nil 'elisp)
470 (setq imenu-case-fold-search nil) 710 (setq imenu-case-fold-search nil)
471 (add-hook 'completion-at-point-functions 711 (add-hook 'completion-at-point-functions
472 'lisp-completion-at-point nil 'local)) 712 'lisp-completion-at-point nil 'local))
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 70ed73eb5ab..18699be1c0b 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -2240,131 +2240,6 @@ Used in `cpp-font-lock-keywords'.")
2240for C preprocessor directives. This definition is for the other modes 2240for C preprocessor directives. This definition is for the other modes
2241in which C preprocessor directives are used. e.g. `asm-mode' and 2241in which C preprocessor directives are used. e.g. `asm-mode' and
2242`ld-script-mode'.") 2242`ld-script-mode'.")
2243
2244
2245;; Lisp.
2246
2247(defconst lisp-font-lock-keywords-1
2248 (eval-when-compile
2249 `(;; Definitions.
2250 (,(concat "(\\(def\\("
2251 ;; Function declarations.
2252 "\\(advice\\|alias\\|generic\\|macro\\*?\\|method\\|"
2253 "setf\\|subst\\*?\\|un\\*?\\|"
2254 "ine-\\(condition\\|"
2255 "\\(?:derived\\|\\(?:global\\(?:ized\\)?-\\)?minor\\|generic\\)-mode\\|"
2256 "method-combination\\|setf-expander\\|skeleton\\|widget\\|"
2257 "function\\|\\(compiler\\|modify\\|symbol\\)-macro\\)\\)\\|"
2258 ;; Variable declarations.
2259 "\\(const\\(ant\\)?\\|custom\\|varalias\\|face\\|parameter\\|var\\(?:-local\\)?\\)\\|"
2260 ;; Structure declarations.
2261 "\\(class\\|group\\|theme\\|package\\|struct\\|type\\)"
2262 "\\)\\)\\_>"
2263 ;; Any whitespace and defined object.
2264 "[ \t'\(]*"
2265 "\\(setf[ \t]+\\(?:\\sw\\|\\s_\\)+\\|\\(?:\\sw\\|\\s_\\)+\\)?")
2266 (1 font-lock-keyword-face)
2267 (9 (cond ((match-beginning 3) font-lock-function-name-face)
2268 ((match-beginning 6) font-lock-variable-name-face)
2269 (t font-lock-type-face))
2270 nil t))
2271 ;; Emacs Lisp autoload cookies. Supports the slightly different
2272 ;; forms used by mh-e, calendar, etc.
2273 ("^;;;###\\([-a-z]*autoload\\)" 1 font-lock-warning-face prepend)
2274 ;; Regexp negated char group.
2275 ("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)))
2276 "Subdued level highlighting for Lisp modes.")
2277
2278(defconst lisp-font-lock-keywords-2
2279 (append lisp-font-lock-keywords-1
2280 (eval-when-compile
2281 `(;; Control structures. Emacs Lisp forms.
2282 (,(concat
2283 "(" (regexp-opt
2284 '("cond" "if" "while" "while-no-input" "let" "let*" "letrec"
2285 "pcase" "pcase-let" "pcase-let*" "prog" "progn" "progv"
2286 "prog1" "prog2" "prog*" "inline" "lambda"
2287 "save-restriction" "save-excursion" "save-selected-window"
2288 "save-window-excursion" "save-match-data" "save-current-buffer"
2289 "combine-after-change-calls" "unwind-protect"
2290 "condition-case" "condition-case-unless-debug"
2291 "track-mouse" "eval-after-load" "eval-and-compile"
2292 "eval-when-compile" "eval-when" "eval-next-after-load"
2293 "with-case-table" "with-category-table" "with-coding-priority"
2294 "with-current-buffer" "with-demoted-errors"
2295 "with-electric-help" "with-eval-after-load"
2296 "with-local-quit" "with-no-warnings"
2297 "with-output-to-string" "with-output-to-temp-buffer"
2298 "with-selected-window" "with-selected-frame"
2299 "with-silent-modifications" "with-syntax-table"
2300 "with-temp-buffer" "with-temp-file" "with-temp-message"
2301 "with-timeout" "with-timeout-handler") t)
2302 "\\_>")
2303 . 1)
2304 ;; Control structures. Common Lisp forms.
2305 (,(concat
2306 "(" (regexp-opt
2307 '("when" "unless" "case" "ecase" "typecase" "etypecase"
2308 "ccase" "ctypecase" "handler-case" "handler-bind"
2309 "restart-bind" "restart-case" "in-package"
2310 "break" "ignore-errors"
2311 "loop" "do" "do*" "dotimes" "dolist" "the" "locally"
2312 "proclaim" "declaim" "declare" "symbol-macrolet" "letf"
2313 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
2314 "destructuring-bind" "macrolet" "tagbody" "block" "go"
2315 "multiple-value-bind" "multiple-value-prog1"
2316 "return" "return-from"
2317 "with-accessors" "with-compilation-unit"
2318 "with-condition-restarts" "with-hash-table-iterator"
2319 "with-input-from-string" "with-open-file"
2320 "with-open-stream" "with-output-to-string"
2321 "with-package-iterator" "with-simple-restart"
2322 "with-slots" "with-standard-io-syntax") t)
2323 "\\_>")
2324 . 1)
2325 ;; Exit/Feature symbols as constants.
2326 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\_>"
2327 "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?")
2328 (1 font-lock-keyword-face)
2329 (2 font-lock-constant-face nil t))
2330 ;; Erroneous structures.
2331 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|\\(?:user-\\)?error\\|signal\\)\\_>" 1 font-lock-warning-face)
2332 ;; Words inside \\[] tend to be for `substitute-command-keys'.
2333 ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]"
2334 (1 font-lock-constant-face prepend))
2335 ;; Words inside `' tend to be symbol names.
2336 ("`\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)'"
2337 (1 font-lock-constant-face prepend))
2338 ;; Constant values.
2339 ("\\_<:\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face)
2340 ;; ELisp and CLisp `&' keywords as types.
2341 ("\\_<\\&\\(?:\\sw\\|\\s_\\)+\\_>" . font-lock-type-face)
2342 ;; ELisp regexp grouping constructs
2343 ((lambda (bound)
2344 (catch 'found
2345 ;; The following loop is needed to continue searching after matches
2346 ;; that do not occur in strings. The associated regexp matches one
2347 ;; of `\\\\' `\\(' `\\(?:' `\\|' `\\)'. `\\\\' has been included to
2348 ;; avoid highlighting, for example, `\\(' in `\\\\('.
2349 (while (re-search-forward "\\(\\\\\\\\\\)\\(?:\\(\\\\\\\\\\)\\|\\((\\(?:\\?[0-9]*:\\)?\\|[|)]\\)\\)" bound t)
2350 (unless (match-beginning 2)
2351 (let ((face (get-text-property (1- (point)) 'face)))
2352 (when (or (and (listp face)
2353 (memq 'font-lock-string-face face))
2354 (eq 'font-lock-string-face face))
2355 (throw 'found t)))))))
2356 (1 'font-lock-regexp-grouping-backslash prepend)
2357 (3 'font-lock-regexp-grouping-construct prepend))
2358 ;; This is too general -- rms.
2359 ;; A user complained that he has functions whose names start with `do'
2360 ;; and that they get the wrong color.
2361 ;; ;; CL `with-' and `do-' constructs
2362 ;;("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
2363 )))
2364 "Gaudy level highlighting for Lisp modes.")
2365
2366(defvar lisp-font-lock-keywords lisp-font-lock-keywords-1
2367 "Default expressions to highlight in Lisp modes.")
2368 2243
2369(provide 'font-lock) 2244(provide 'font-lock)
2370 2245