Skip to content

Commit 73ff22e

Browse files
authored
Merge pull request #51 from Hi-Angel/rm-older-comments
Font-lock module commentary cleanup
2 parents 0f7b4ad + 652c7cc commit 73ff22e

File tree

1 file changed

+1
-82
lines changed

1 file changed

+1
-82
lines changed

purescript-font-lock.el

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,6 @@
5252
;; highlighted as constructors or not. Should the `->' in
5353
;; `id :: a -> a' be considered a constructor or a keyword? If so,
5454
;; how do we distinguish this from `\x -> x'? What about the `\'?
55-
;;
56-
;; . XEmacs can support both `--' comments and `{- -}' comments
57-
;; simultaneously. If XEmacs is detected, this should be used.
58-
;;
59-
;; . Support for GreenCard?
60-
;;
61-
;;
62-
;; All functions/variables start with
63-
;; `(turn-(on/off)-)purescript-font-lock' or `purescript-fl-'.
64-
65-
;;; Change Log:
66-
67-
;; Version 1.3:
68-
;; From Dave Love:
69-
;; Support for proper behaviour (including with Unicode identifiers)
70-
;; in Emacs 21 only hacked in messily to avoid disturbing the old
71-
;; stuff. Needs integrating more cleanly. Allow literate comment
72-
;; face to be customized. Some support for fontifying definitions.
73-
;; (I'm not convinced the faces should be customizable -- fontlock
74-
;; faces are normally expected to be consistent.)
75-
;;
76-
;; Version 1.2:
77-
;; Added support for LaTeX-style literate scripts. Allow whitespace
78-
;; after backslash to end a line for string continuations.
79-
;;
80-
;; Version 1.1:
81-
;; Use own syntax table. Use backquote (neater). Stop ''' being
82-
;; highlighted as quoted character. Fixed `\"' fontification bug
83-
;; in comments.
84-
;;
85-
;; Version 1.0:
86-
;; Brought over from PureScript mode v1.1.
8755

8856
;;; Code:
8957

@@ -107,7 +75,7 @@
10775
("&&" . ,(decode-char 'ucs #X2227))
10876
("||" . ,(decode-char 'ucs #X2228))
10977
("sqrt" . ,(decode-char 'ucs #X221A))
110-
("undefined" . ,(decode-char 'ucs #X22A5)) ;; Not really needed for Purescript
78+
("undefined" . ,(decode-char 'ucs #X22A5))
11179
("pi" . ,(decode-char 'ucs #X3C0))
11280
("~>" . ,(decode-char 'ucs 8669)) ;; Omega language
11381
("-<" . ,(decode-char 'ucs 8610)) ;; Paterson's arrow syntax
@@ -244,55 +212,6 @@ Returns keywords suitable for `font-lock-keywords'."
244212
purescript-constructor-face
245213
purescript-operator-face)))))
246214

247-
;; The next three aren't used in Emacs 21.
248-
249-
(defvar purescript-fl-latex-cache-pos nil
250-
"Position of cache point used by `purescript-fl-latex-cache-in-comment'.
251-
Should be at the start of a line.")
252-
253-
(defvar purescript-fl-latex-cache-in-comment nil
254-
"If `purescript-fl-latex-cache-pos' is outside a
255-
\\begin{code}..\\end{code} block (and therefore inside a comment),
256-
this variable is set to t, otherwise nil.")
257-
258-
(defun purescript-fl-latex-comments (end)
259-
"Sets `match-data' according to the region of the buffer before end
260-
that should be commented under LaTeX-style literate scripts."
261-
(let ((start (point)))
262-
(if (= start end)
263-
;; We're at the end. No more to fontify.
264-
nil
265-
(if (not (eq start purescript-fl-latex-cache-pos))
266-
;; If the start position is not cached, calculate the state
267-
;; of the start.
268-
(progn
269-
(setq purescript-fl-latex-cache-pos start)
270-
;; If the previous \begin{code} or \end{code} is a
271-
;; \begin{code}, then start is not in a comment, otherwise
272-
;; it is in a comment.
273-
(setq purescript-fl-latex-cache-in-comment
274-
(if (and
275-
(re-search-backward
276-
"^\\(\\(\\\\begin{code}\\)\\|\\(\\\\end{code}\\)\\)$"
277-
(point-min) t)
278-
(match-end 2))
279-
nil t))
280-
;; Restore position.
281-
(goto-char start)))
282-
(if purescript-fl-latex-cache-in-comment
283-
(progn
284-
;; If start is inside a comment, search for next \begin{code}.
285-
(re-search-forward "^\\\\begin{code}$" end 'move)
286-
;; Mark start to end of \begin{code} (if present, till end
287-
;; otherwise), as a comment.
288-
(set-match-data (list start (point)))
289-
;; Return point, as a normal regexp would.
290-
(point))
291-
;; If start is inside a code block, search for next \end{code}.
292-
(if (re-search-forward "^\\\\end{code}$" end t)
293-
;; If one found, mark it as a comment, otherwise finish.
294-
(point))))))
295-
296215
(defconst purescript-basic-syntactic-keywords
297216
'(;; Character constants (since apostrophe can't have string syntax).
298217
;; Beware: do not match something like 's-}' or '\n"+' since the first '

0 commit comments

Comments
 (0)