From: budu <nbuduroi@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to evaluating expressions in *inferior-lisp* buffer programatically?
Date: Sat, 14 Mar 2009 12:15:27 -0700 (PDT) [thread overview]
Message-ID: <220f49dc-f1d0-46de-a85c-604c946ac70f@o36g2000yqh.googlegroups.com> (raw)
In-Reply-To: 87ljr8t6n2.fsf@galatea.local
On Mar 14, 12:24 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> budu <nbudu...@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__
Great! This will be much cleaner. Thanks
next prev parent reply other threads:[~2009-03-14 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-14 16:07 How to evaluating expressions in *inferior-lisp* buffer programatically? budu
2009-03-14 16:24 ` Pascal J. Bourguignon
2009-03-14 19:15 ` budu [this message]
2009-03-14 19:54 ` Pascal J. Bourguignon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=220f49dc-f1d0-46de-a85c-604c946ac70f@o36g2000yqh.googlegroups.com \
--to=nbuduroi@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.