emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Daly <nick.m.daly@gmail.com>
To: Kyle Meyer <kyle@kyleam.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ob-haskell: Line Continuations Mangle Block Output
Date: Sun, 31 May 2020 12:00:03 -0500	[thread overview]
Message-ID: <CAM-YhhD4NQaG=J_RgLHN0tT7-6xyMQD8yjmWBJcqFBqja5PwZA@mail.gmail.com> (raw)
In-Reply-To: <87367nlfw5.fsf@kyleam.com>

[-- Attachment #1: Type: text/plain, Size: 1662 bytes --]

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 #2: ghc-prelude-prompt-testing.txt --]
[-- Type: text/plain, Size: 1257 bytes --]

Prelude> import Data.Time
Prelude Data.Time> :m + Data.Time.Clock
Prelude Data.Time Data.Time.Clock> scanl (+) 0 [1,2,3,4]
"org-babel-haskell-eoe"
[0,1,3,6,10]
Prelude Data.Time Data.Time.Clock> "org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock> :{
flip' :: (a -> b -> c) -> (b -> a -> c)
flip' f = \x y -> f y x
:}
"org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock> "org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock> :{
sum' :: (Num a) => [a] -> a
sum' xs = foldl (\ acc x -> acc + x) 0 xs
:}
sum' [1,2,3,4] == 10
"org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock> True
Prelude Data.Time Data.Time.Clock> "org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock> :{
sum' :: (Num a) => [a] -> a
sum' xs = foldl (\ acc x -> acc + x) 0 xs
:}
print "hi"
"org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock| Prelude Data.Time Data.Time.Clock> "hi"
Prelude Data.Time Data.Time.Clock> "org-babel-haskell-eoe"
Prelude Data.Time Data.Time.Clock>

  reply	other threads:[~2020-05-31 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 19:30 [PATCH] ob-haskell: Line Continuations Mangle Block Output Nick Daly
2020-05-17 20:07 ` Nick Daly
2020-05-20  5:51   ` Kyle Meyer
2020-05-24  0:02     ` Nick Daly
2020-05-24  2:46       ` Nick Daly
2020-05-26  0:05         ` Kyle Meyer
2020-05-31 17:00           ` Nick Daly [this message]
2020-05-26  0:02       ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM-YhhD4NQaG=J_RgLHN0tT7-6xyMQD8yjmWBJcqFBqja5PwZA@mail.gmail.com' \
    --to=nick.m.daly@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).