emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-haskell: Line Continuations Mangle Block Output


From: Nick Daly
Subject: Re: [PATCH] ob-haskell: Line Continuations Mangle Block Output
Date: Sun, 31 May 2020 12:00:03 -0500

Hi Kyle, thank you again for your help and analysis.  In summary,
org-mode needs no patches, but inf-haskell's comint-prompt-regexp
needs updates.  I'll follow up with the inf-haskell maintainers.

----

> inf-haskell used to set comint-prompt-regexp in the body of
> inferior-haskell-mode...  This is inf-haskell's variable.
> ob-haskell shouldn't set it.

Thank you for your help in all this.  I couldn't find where the regex
was set in the org-mode source because it wasn't coming from org-mode
at all.  Putting this all together suggests that the correct fix is to
update the inf-haskell regex to handle "Prelude| " correctly in the
first place.

I believe it's possible to compress the current inf-haskell regexp
from this:

    (setq-local comint-prompt-regexp
                ;; Why the backslash in [\\._[:alnum:]]?
                "^\\*?[[:upper:]][\\._[:alnum:]]*\\(?:
\\*?[[:upper:]][\\._[:alnum:]]*\\)*\\( λ\\)?> \\|^λ?> $")

Down into this, without any significant loss of fidelity.  We really
don't care about any characters at the start of the line before the
final "> ".

    (setq-local comint-prompt-regexp "^[[:alnum:].*_() |λ]*> ")

This seems useful because, as I discovered this morning, importing
modules mangles the prompt further:

    Prelude> import Data.Time
    Prelude Data.Time> :m + Data.Time.Clock
    Prelude Data.Time Data.Time.Clock>

The testing data that this configuration correctly parsed is attached
for reference.

I'll figure out where to submit that patch to, and send it off.  It's
a single line change that shouldn't require any assignment papers.

Thanks again,
Nick

Attachment: ghc-prelude-prompt-testing.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]