I want to clear the ghci screen of the haskell-mode,

I used erase-buffer in emacs shell, and I works, but when I do so with ghci inside emacs, This message appears:

Text is read-only
  • did you try using comint-clear-buffer bound to C-c M-o ? this will work for all comint based interactive processes. Commented Feb 6, 2017 at 3:45
  • Error: "Wrong type argument: processp, nil"
    – T.Magdy
    Commented Feb 6, 2017 at 6:14
  • I've found a solution. (C-c C-k) == M-x haskell-interactive-mode-clear
    – T.Magdy
    Commented Feb 6, 2017 at 6:15
  • Ah yes, that's the same shortcut I use for intero repl :) I forgot it worked for haskell interactive mode as well. Commented Feb 6, 2017 at 6:35
  • @T.Magdy: please post your solution and accept it so that we can mark this post as answered.
    – Dan
    Commented Feb 6, 2017 at 19:42

1 Answer 1


In haskell-mode, C-c C-l calls haskell-process-load-or-reload, and you go into a sub-mode called haskell-cabal-mode-map.

In that mode there is a command haskell-interactive-mode-clear to clear the ghci buffer. (erase-buffer does not work, because the buffer is read-only so you cannot erase it)

So You can map haskell-interactive-mode-clear like that:

(eval-after-load 'haskell-cabal '(progn (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.