Skip to content

Commit 08b295b

Browse files
authored
Merge pull request #41 from Hi-Angel/more-tests3
Remove turn-on-purescript-font-lock and turn-off-purescript-font-lock
2 parents 73ff22e + 117a660 commit 08b295b

File tree

1 file changed

+20
-75
lines changed

1 file changed

+20
-75
lines changed

purescript-font-lock.el

Lines changed: 20 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,32 @@
3131
;; functions, etc. Supports full PureScript 1.4 as well as LaTeX- and
3232
;; Bird-style literate scripts.
3333
;;
34-
;; Installation:
34+
;; Customisation:
3535
;;
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:
3841
;;
39-
;; (add-hook 'purescript-mode-hook 'turn-on-purescript-font-lock)
42+
;; (setq font-lock-maximum-decoration \\='((purescript-mode . 2) (t . 0)))
4043
;;
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.
4246
;;
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:
4349
;;
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.
4556
;;
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.
4860
;;
4961
;; Present Limitations/Future Work (contributions are most welcome!):
5062
;;
@@ -318,73 +330,6 @@ Returns keywords suitable for `font-lock-keywords'."
318330
;; Get help from font-lock-syntactic-keywords.
319331
(parse-sexp-lookup-properties . t))))
320332

321-
;; The main functions.
322-
(defun turn-on-purescript-font-lock ()
323-
"Turns on font locking in current buffer for PureScript 1.4 scripts.
324-
325-
Changes the current buffer\\='s `font-lock-defaults', and adds the
326-
following variables:
327-
328-
`purescript-keyword-face' for reserved keywords and syntax,
329-
`purescript-constructor-face' for data- and type-constructors, class names,
330-
and module names,
331-
`purescript-operator-face' for symbolic and alphanumeric operators,
332-
`purescript-default-face' for ordinary code.
333-
334-
The variables are initialised to the following font lock default faces:
335-
336-
`purescript-keyword-face' `font-lock-keyword-face'
337-
`purescript-constructor-face' `font-lock-type-face'
338-
`purescript-operator-face' `font-lock-function-name-face'
339-
`purescript-default-face' <default face>
340-
341-
Two levels of fontification are defined: level one (the default)
342-
and level two (more colour). The former does not colour operators.
343-
Use the variable `font-lock-maximum-decoration' to choose
344-
non-default levels of fontification. For example, adding this to
345-
.emacs:
346-
347-
(setq font-lock-maximum-decoration \\='((purescript-mode . 2) (t . 0)))
348-
349-
uses level two fontification for `purescript-mode' and default level for
350-
all other modes. See documentation on this variable for further
351-
details.
352-
353-
To alter an attribute of a face, add a hook. For example, to change
354-
the foreground colour of comments to brown, add the following line to
355-
.emacs:
356-
357-
(add-hook \\='purescript-font-lock-hook
358-
(lambda ()
359-
(set-face-foreground \\='purescript-comment-face \"brown\")))
360-
361-
Note that the colours available vary from system to system. To see
362-
what colours are available on your system, call
363-
`list-colors-display' from emacs.
364-
365-
To turn font locking on for all PureScript buffers, add this to .emacs:
366-
367-
(add-hook \\='purescript-mode-hook \\='turn-on-purescript-font-lock)
368-
369-
To turn font locking on for the current buffer, call
370-
`turn-on-purescript-font-lock'. To turn font locking off in the current
371-
buffer, call `turn-off-purescript-font-lock'.
372-
373-
Bird-style literate PureScript scripts are supported: If the value of
374-
`purescript-literate-bird-style' (automatically set by the PureScript mode
375-
of Moss&Thorn) is non-nil, a Bird-style literate script is assumed.
376-
377-
Invokes `purescript-font-lock-hook' if not nil."
378-
(purescript-font-lock-defaults-create)
379-
(run-hooks 'purescript-font-lock-hook)
380-
(turn-on-font-lock))
381-
382-
(defun turn-off-purescript-font-lock ()
383-
"Turns off font locking in current buffer."
384-
(font-lock-mode -1))
385-
386-
;; Provide ourselves:
387-
388333
(provide 'purescript-font-lock)
389334

390335
;; Local Variables:

0 commit comments

Comments
 (0)