haskell / haskell/haskell-mode
QuasiQuote submode handling produces many warnings
- Dominant language
- Emacs Lisp
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
I've just spent hours tracking down prolific errors like the following, which occur only when editing certain Haskell files:
```
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 1888
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 2100
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 2100
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 2343
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 2343
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 1119
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 1119
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 1888
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 1888
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 2100
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 2100
Invalid face reference: 1
Invalid face reference: nil
Invalid face reference: 2343
Invalid face reference: nil [2 times]
Invalid face reference: 1
Invalid face reference: nil [4 times]
Invalid face reference: 2343
Invalid face reference: 1
```
I discovered that the cause is that `haskell-syntactic-face-function` does not conform with the behaviour expected of a `font-lock-syntactic-face-function`, because those functions must always return a face name.
Particularly in the case of quasiquoting, where the quasiquote is recognised as a member of `haskell-font-lock-quasi-quote-modes`, the function hands off propertization to the language mode (e.g. `sql-mode`) before deliberately returning `nil`. Indeed, to return anything else overrides the sub-mode's work.
So it seems like we're abusing syntactic faces, and should find another approach. However, I'm not sure of the best solution.
(Observed in both Emacs 25.3 and 26/27 development snapshots: I haven't tested with older versions.)
Contributor guide
Assessment
This issue has not been assessed yet.