unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* inferior lisp - eval buffer
@ 2011-03-12 18:16 Mark Carter
  2011-03-12 19:33 ` Pascal J. Bourguignon
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Carter @ 2011-03-12 18:16 UTC (permalink / raw)
  To: help-gnu-emacs

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))

Please help.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: inferior lisp - eval buffer
  2011-03-12 18:16 inferior lisp - eval buffer Mark Carter
@ 2011-03-12 19:33 ` Pascal J. Bourguignon
  0 siblings, 0 replies; 2+ messages in thread
From: Pascal J. Bourguignon @ 2011-03-12 19:33 UTC (permalink / raw)
  To: help-gnu-emacs

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 {}.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-12 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-12 18:16 inferior lisp - eval buffer Mark Carter
2011-03-12 19:33 ` Pascal J. Bourguignon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).