jyp / dante

389 stars 52 forks source link

Need to set --repl-options=-fdiagnostics-color=never #134

Closed tomjaguarpaw closed 4 years ago

tomjaguarpaw commented 4 years ago

It seems like I need to customize Dante to use --repl-options=-fdiagnostics-color=never, otherwise the output of cabal v2-repl can contain control characters used for colouring and formatting the error message text.

I'm rather puzzled why this doesn't seem to have been reported before. What's the right solution? Should this option be added to Dante itself?

jyp commented 4 years ago

If this option can be set within GHCi then we should do that. Otherwise it should be added to the command line. Otherwise the variable to modify is dante-methods-alist. Please propose a PR when you're happy with your setup.

tomjaguarpaw commented 4 years ago

On Tue, Dec 03, 2019 at 10:54:24PM -0800, Jean-Philippe Bernardy wrote:

If this option can be set within GHCi then we should do that. Otherwise it should be added to the command line. Otherwise the variable to modify is dante-methods-alist. Please propose a PR when you're happy with your setup.

Yes, it can be set in GHCi with

:set -fdiagnostics-color=never
jyp commented 4 years ago

I have added this flag. Let me know if the issue persists. Thanks again for the report!

toelli-msft commented 4 years ago

Strangely, without the flag the problem only occurs when a Haskell source file is mentioned on the emacs command line. If the Haskell source file is loaded with C-x C-f then no colour will appear in any case.

Anyway, the flag you have added solves the problem. Could it be turned on by default?

tomjaguarpaw commented 4 years ago

(In fact I'm not sure it's even useful to present the user with the possibility of disabling it)

jyp commented 4 years ago

@toelli-msft Sorry I had forgotten to do that.

jyp commented 4 years ago

Should be good with the last commit!