* How to evaluating expressions in *inferior-lisp* buffer programatically?
@ 2009-03-14 16:07 budu
2009-03-14 16:24 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: budu @ 2009-03-14 16:07 UTC (permalink / raw)
To: help-gnu-emacs
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
- budu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to evaluating expressions in *inferior-lisp* buffer programatically?
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
0 siblings, 1 reply; 4+ messages in thread
From: Pascal J. Bourguignon @ 2009-03-14 16:24 UTC (permalink / raw)
To: help-gnu-emacs
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__
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to evaluating expressions in *inferior-lisp* buffer programatically?
2009-03-14 16:24 ` Pascal J. Bourguignon
@ 2009-03-14 19:15 ` budu
2009-03-14 19:54 ` Pascal J. Bourguignon
0 siblings, 1 reply; 4+ messages in thread
From: budu @ 2009-03-14 19:15 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to evaluating expressions in *inferior-lisp* buffer programatically?
2009-03-14 19:15 ` budu
@ 2009-03-14 19:54 ` Pascal J. Bourguignon
0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2009-03-14 19:54 UTC (permalink / raw)
To: help-gnu-emacs
budu <nbuduroi@gmail.com> writes:
> On Mar 14, 12:24 pm, p...@informatimago.com (Pascal J. Bourguignon)
> wrote:
>> budu <nbudu...@gmail.com> writes:
>> > 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)")
>
> Great! This will be much cleaner. Thanks
Notice that when you use slime, you can also call emacs functions from
the inferior lisp. http://paste.lisp.org/display/22414
(it's a little old, I don't know if it still works with current
versions of slime).
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-14 19:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-03-14 19:54 ` 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).