[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inferior lisp - eval buffer
From: |
Pascal J. Bourguignon |
Subject: |
Re: inferior lisp - eval buffer |
Date: |
Sat, 12 Mar 2011 20:33:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Mark Carter <alt.mcarter@gmail.com> writes:
> I would like to create an interactive function that evaluates a buffer
> to an inferior lisp.
>
> I presume it's going to look something like:
>
> (defun eval-lisp-buffer ()
> (interactive)
> (lisp-eval-region something something))
Yes. I have:
(defun lisp-eval-last-sexp (&optional and-go)
"Send the previous sexp to the inferior Lisp process.
Prefix argument means switch to the Lisp buffer afterwards."
(interactive "P")
(lisp-eval-region (save-excursion (backward-sexp) (point))
(point)
and-go))
in my ~/.emacs, along with:
(add-hook 'lisp-mode-hook
(lambda () (local-set-key (kbd "C-x C-e") 'lisp-eval-last-sexp)))
For the while buffer, you'd use (point-min) and (point-max), I guess,
but I'm not sure lisp-eval-region can take several sexps. Check it.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.