Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inferior-haskell: do not insert repeated prompts. #1806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cnngimenez
Copy link

Hi!

I found that ob-haskell.el shows multiple prompts at any code block output. This was a little annoying for me, so I tried to fix it. Then, I realized it was from the inferior-haskell: It did not remove the prompts from the process output.
For example, when starting an inferior Haskell with M-x run-haskell and writing a multiple line function, the "*haskell*" buffer looks like this:

Loaded package environment from /home/poo/.ghc/x86_64-linux-9.0.2/environments/default
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> ghci> :{
f x
  | x == 0 = 1
  | x < 0  = 1
  | otherwise = 2 * f (x - 1)
:}

ghci| ghci| ghci| ghci| ghci| ghci> ghci> 

Therefore, I wrote a function to remove all prompts except for the last one. All continuation prompts (ending with "| ") are completely removed too. After that, I added it to the hook comint-preoutput-filter-outputs buffer-locally. Now, the result in the "*haskell*" buffer is:

Loaded package environment from /home/poo/.ghc/x86_64-linux-9.0.2/environments/default
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> :{
f x
  | x == 0 = 1
  | x < 0  = 1
  | otherwise = 2 * f (x - 1)
:}

ghci> 

I believe that this output is easier to read, and the ob-haskell.el (and maybe other libraries) process the buffer output without the need for more code.

Is it good to include this modification?
Does this patch requires any other change?
Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant