4

I'm trying to add more symbols to haskell-mode's haskell-font-lock.

The documentation for haskell-font-lock-symbols-alist says:

Alist mapping Haskell symbols to chars. Each element has the form (STRING . CHAR) or (STRING CHAR PREDICATE). STRING is the Haskell symbol. CHAR is the character with which to represent this symbol. PREDICATE if present is a function of one argument (the start position of the symbol) which should return non-nil if this mapping should be disabled at that position.

I'm trying something like:

(add-to-list 'haskell-font-lock-symbols-alist `("heart" . 2665)) 

But when typing 'heart' in haskell mode the font-lock won't work, although it works for ->, ., =>.

What am I missing ?

1 Answer 1

4

The important value at runtime is haskell-font-lock-keywords, which is generated from the alist when loading haskell-font-lock.el. After changing haskell-font-lock-symbols-alist you will also have to recompute the value of hakskell-font-lock-keywords.

This snippet will add the heart character to the alist and recompute haskell-font-lock-keywords such that heart in a Haskell source file is rendered as :

(eval-after-load 'haskell-font-lock '(progn (add-to-list 'haskell-font-lock-symbols-alist `("heart" . 9829)) (setq haskell-font-lock-keywords (haskell-font-lock-keywords-create nil)))) 
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.