[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to evaluating expressions in *inferior-lisp* buffer programatica
From: |
Pascal J. Bourguignon |
Subject: |
Re: How to evaluating expressions in *inferior-lisp* buffer programatically? |
Date: |
Sat, 14 Mar 2009 17:24:01 +0100 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) |
budu <nbuduroi@gmail.com> writes:
> Hi, I've been using Emacs for a few year, but I'm just starting to
> customize it more deeply. I wonder what is the recommended way of
> evaluating expressions in the current *inferior-lisp* buffer
> programatically? I know macros would certainly be OK for such a simple
> task, yet I tried with elisp and come up with this:
>
> (save-current-buffer
> (set-buffer "*inferior-lisp*")
> (insert "(use '(foo [bar]))")
> (lisp-eval-last-sexp)
> (let ((s (point)))
> (backward-sexp)
> (delete-region s (point))))
>
> Do you know of a more straightforward way of doing this? And do you
> know of any good tutorial on basic elisp? Thanks
(defun eval-in-inferior-lisp (expression-string)
(comint-send-string (inferior-lisp-proc) (format " %s\n" expression-string))
(switch-to-lisp t))
(eval-in-inferior-lisp "(- 22/7 cl:pi)")
--
__Pascal Bourguignon__