emacscider

emacs cider clear REPL buffer


I simply want to clear the repl buffer so that a single prompt eg (user>) is left on the first line.

I have a keybinding:

(put 'erase-buffer 'disabled nil)
(global-set-key (kbd "C-x C-<backspace>") 'erase-buffer)

But this gives the message :

text is read only

There is the option C-c C-o but this only clears the last return value.

When using python, and run-python the following command C-x M-o which i believe is comint-clear-buffer


Solution

  • cider-repl.el provides a function cider-repl-clear-buffer which by default is bound to:

    M-x c-r--bu RET

    as C-c M-b is not used by cider-repl as far as I am aware:

    (add-hook 'cider-repl-mode-hook
          '(lambda () (define-key cider-repl-mode-map (kbd "C-c M-b")
                'cider-repl-clear-buffer)))