Frank Zalkow <
fza...@gmail.com> writes:
> Hey Lispers,
>
> I would like to know if it is possible to clear the current REPL in Emacs from CL.
>
> If I do it from emacs lisp
> M-x eval-expression: (let ((inhibit-read-only t)) (interactive) (erase-buffer))
> it works fine.
>
> So I thought it should work to do
> M-x eval-expression: (setq slime-enable-evaluate-in-emacs t)
>
> and call a function like this
>
> (defun clear-emacs-buffer ()
> (swank:eval-in-emacs
> '(let ((inhibit-read-only t)) (interactive) (erase-buffer))))
>
> But calling this function just returns NIL and doesn't clear the buffer.
M-x slime RET C-h k C-c M-o
indicates the command to use is slime-repl-clear-buffer, not
erase-buffer.
(swank:eval-in-emacs 'slime-repl-clear-buffer)
fails with an obvious re-entrancy error.
Therefore:
(swank:eval-in-emacs '(progn
(run-at-time 1 nil 'slime-repl-clear-buffer)
nil))
should do it.
--
__Pascal Bourguignon__
http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk