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. Feb 6 '17 at 3:45
  • Error: "Wrong type argument: processp, nil"
    – T.Magdy
    Feb 6 '17 at 6:14
  • I've found a solution. (C-c C-k) == M-x haskell-interactive-mode-clear
    – T.Magdy
    Feb 6 '17 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. Feb 6 '17 at 6:35
  • @T.Magdy: please post your solution and accept it so that we can mark this post as answered.
    – Dan
    Feb 6 '17 at 19:42

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, privacy policy and cookie policy

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