|
31 | 31 | ;; functions, etc. Supports full PureScript 1.4 as well as LaTeX- and
|
32 | 32 | ;; Bird-style literate scripts.
|
33 | 33 | ;;
|
34 |
| -;; Installation: |
| 34 | +;; Customisation: |
35 | 35 | ;;
|
36 |
| -;; To turn font locking on for all PureScript buffers under the PureScript |
37 |
| -;; mode of Moss&Thorn, add this to .emacs: |
| 36 | +;; Two levels of fontification are defined: level one (the default) |
| 37 | +;; and level two (more colour). The former does not colour operators. |
| 38 | +;; Use the variable `font-lock-maximum-decoration' to choose |
| 39 | +;; non-default levels of fontification. For example, adding this to |
| 40 | +;; .emacs: |
38 | 41 | ;;
|
39 |
| -;; (add-hook 'purescript-mode-hook 'turn-on-purescript-font-lock) |
| 42 | +;; (setq font-lock-maximum-decoration \\='((purescript-mode . 2) (t . 0))) |
40 | 43 | ;;
|
41 |
| -;; Otherwise, call `turn-on-purescript-font-lock'. |
| 44 | +;; uses level two fontification for `purescript-mode' and default level for all |
| 45 | +;; other modes. See documentation on this variable for further details. |
42 | 46 | ;;
|
| 47 | +;; To alter an attribute of a face, add a hook. For example, to change the |
| 48 | +;; foreground colour of comments to brown, add the following line to .emacs: |
43 | 49 | ;;
|
44 |
| -;; Customisation: |
| 50 | +;; (add-hook \\='purescript-font-lock-hook |
| 51 | +;; (lambda () |
| 52 | +;; (set-face-foreground \\='purescript-comment-face \"brown\"))) |
| 53 | +;; |
| 54 | +;; Note that the colours available vary from system to system. To see what |
| 55 | +;; colours are available on your system, call `list-colors-display' from emacs. |
45 | 56 | ;;
|
46 |
| -;; The colours and level of font locking may be customised. See the |
47 |
| -;; documentation on `turn-on-purescript-font-lock' for more details. |
| 57 | +;; Bird-style literate PureScript scripts are supported: If the value of |
| 58 | +;; `purescript-literate-bird-style' (automatically set by the PureScript mode of |
| 59 | +;; Moss&Thorn) is non-nil, a Bird-style literate script is assumed. |
48 | 60 | ;;
|
49 | 61 | ;; Present Limitations/Future Work (contributions are most welcome!):
|
50 | 62 | ;;
|
@@ -418,73 +430,6 @@ that should be commented under LaTeX-style literate scripts."
|
418 | 430 | ;; Get help from font-lock-syntactic-keywords.
|
419 | 431 | (parse-sexp-lookup-properties . t))))
|
420 | 432 |
|
421 |
| -;; The main functions. |
422 |
| -(defun turn-on-purescript-font-lock () |
423 |
| - "Turns on font locking in current buffer for PureScript 1.4 scripts. |
424 |
| -
|
425 |
| -Changes the current buffer\\='s `font-lock-defaults', and adds the |
426 |
| -following variables: |
427 |
| -
|
428 |
| - `purescript-keyword-face' for reserved keywords and syntax, |
429 |
| - `purescript-constructor-face' for data- and type-constructors, class names, |
430 |
| - and module names, |
431 |
| - `purescript-operator-face' for symbolic and alphanumeric operators, |
432 |
| - `purescript-default-face' for ordinary code. |
433 |
| -
|
434 |
| -The variables are initialised to the following font lock default faces: |
435 |
| -
|
436 |
| - `purescript-keyword-face' `font-lock-keyword-face' |
437 |
| - `purescript-constructor-face' `font-lock-type-face' |
438 |
| - `purescript-operator-face' `font-lock-function-name-face' |
439 |
| - `purescript-default-face' <default face> |
440 |
| -
|
441 |
| -Two levels of fontification are defined: level one (the default) |
442 |
| -and level two (more colour). The former does not colour operators. |
443 |
| -Use the variable `font-lock-maximum-decoration' to choose |
444 |
| -non-default levels of fontification. For example, adding this to |
445 |
| -.emacs: |
446 |
| -
|
447 |
| - (setq font-lock-maximum-decoration \\='((purescript-mode . 2) (t . 0))) |
448 |
| -
|
449 |
| -uses level two fontification for `purescript-mode' and default level for |
450 |
| -all other modes. See documentation on this variable for further |
451 |
| -details. |
452 |
| -
|
453 |
| -To alter an attribute of a face, add a hook. For example, to change |
454 |
| -the foreground colour of comments to brown, add the following line to |
455 |
| -.emacs: |
456 |
| -
|
457 |
| - (add-hook \\='purescript-font-lock-hook |
458 |
| - (lambda () |
459 |
| - (set-face-foreground \\='purescript-comment-face \"brown\"))) |
460 |
| -
|
461 |
| -Note that the colours available vary from system to system. To see |
462 |
| -what colours are available on your system, call |
463 |
| -`list-colors-display' from emacs. |
464 |
| -
|
465 |
| -To turn font locking on for all PureScript buffers, add this to .emacs: |
466 |
| -
|
467 |
| - (add-hook \\='purescript-mode-hook \\='turn-on-purescript-font-lock) |
468 |
| -
|
469 |
| -To turn font locking on for the current buffer, call |
470 |
| -`turn-on-purescript-font-lock'. To turn font locking off in the current |
471 |
| -buffer, call `turn-off-purescript-font-lock'. |
472 |
| -
|
473 |
| -Bird-style literate PureScript scripts are supported: If the value of |
474 |
| -`purescript-literate-bird-style' (automatically set by the PureScript mode |
475 |
| -of Moss&Thorn) is non-nil, a Bird-style literate script is assumed. |
476 |
| -
|
477 |
| -Invokes `purescript-font-lock-hook' if not nil." |
478 |
| - (purescript-font-lock-defaults-create) |
479 |
| - (run-hooks 'purescript-font-lock-hook) |
480 |
| - (turn-on-font-lock)) |
481 |
| - |
482 |
| -(defun turn-off-purescript-font-lock () |
483 |
| - "Turns off font locking in current buffer." |
484 |
| - (font-lock-mode -1)) |
485 |
| - |
486 |
| -;; Provide ourselves: |
487 |
| - |
488 | 433 | (provide 'purescript-font-lock)
|
489 | 434 |
|
490 | 435 | ;; Local Variables:
|
|
0 commit comments