From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: budu Newsgroups: gmane.emacs.help Subject: Re: How to evaluating expressions in *inferior-lisp* buffer programatically? Date: Sat, 14 Mar 2009 12:15:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: <220f49dc-f1d0-46de-a85c-604c946ac70f@o36g2000yqh.googlegroups.com> References: <1c955ff2-b6a2-4ab5-bd8a-a08d0ffc97c3@13g2000yql.googlegroups.com> <87ljr8t6n2.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1237059873 10040 80.91.229.12 (14 Mar 2009 19:44:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Mar 2009 19:44:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 14 20:45:50 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LiZnn-0006Bc-Q7 for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Mar 2009 20:45:48 +0100 Original-Received: from localhost ([127.0.0.1]:40451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LiZmQ-0002LJ-MQ for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Mar 2009 15:44:22 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!postnews.google.com!o36g2000yqh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 24.202.192.143 Original-X-Trace: posting.google.com 1237058127 970 127.0.0.1 (14 Mar 2009 19:15:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 14 Mar 2009 19:15:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o36g2000yqh.googlegroups.com; posting-host=24.202.192.143; posting-account=dC21OQoAAABW9bHlIPp6ckh_M-fDoV_Y User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729), gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:167544 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62911 Archived-At: On Mar 14, 12:24=A0pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: > budu 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: > > > =A0 =A0 (save-current-buffer > > =A0 =A0 =A0 (set-buffer "*inferior-lisp*") > > =A0 =A0 =A0 (insert "(use '(foo [bar]))") > > =A0 =A0 =A0 (lisp-eval-last-sexp) > > =A0 =A0 =A0 (let ((s (point))) > > =A0 =A0 =A0 =A0 (backward-sexp) > > =A0 =A0 =A0 =A0 (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) > =A0 (comint-send-string (inferior-lisp-proc) (format " %s\n" expression-s= tring)) > =A0 (switch-to-lisp t)) > > (eval-in-inferior-lisp "(- 22/7 cl:pi)") > > -- > __Pascal Bourguignon__ Great! This will be much cleaner. Thanks