From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johan Andersson Newsgroups: gmane.emacs.help Subject: Re: Reset Emacs state Date: Tue, 2 Mar 2010 11:48:04 +0000 Message-ID: <929ccd881003020348x57b4c0ebhb396cabfb0f8678a@mail.gmail.com> References: <929ccd881003020241g8fa36cdq6462baab058de215@mail.gmail.com> <929ccd881003020303w5b4635d8r6e452142e5076c35@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016367fa8f549aa580480cff0a8 X-Trace: dough.gmane.org 1267531423 15882 80.91.229.12 (2 Mar 2010 12:03:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Mar 2010 12:03:43 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Lennart Borgman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 02 13:03:39 2010 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.69) (envelope-from ) id 1NmQp8-00065L-3W for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Mar 2010 13:03:38 +0100 Original-Received: from localhost ([127.0.0.1]:53565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmQdE-0002Fo-9J for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Mar 2010 06:51:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmQa9-0000MC-3g for help-gnu-emacs@gnu.org; Tue, 02 Mar 2010 06:48:09 -0500 Original-Received: from [140.186.70.92] (port=33014 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmQa7-0000KD-6N for help-gnu-emacs@gnu.org; Tue, 02 Mar 2010 06:48:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmQa6-000779-56 for help-gnu-emacs@gnu.org; Tue, 02 Mar 2010 06:48:07 -0500 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:58867) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmQa5-000774-UL for help-gnu-emacs@gnu.org; Tue, 02 Mar 2010 06:48:06 -0500 Original-Received: by wyb29 with SMTP id 29so75544wyb.0 for ; Tue, 02 Mar 2010 03:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Lc+kwmgr73LqGNerzIG9u9VQHZVD1q5PNu6rhMfpPng=; b=UWD2rEmRk/gfpRtKTmY2Z1NTEp9MRtGsTnC/TVYtWnxGQjwcLbEO8XBHB1ZYB2XB05 lCqRC+UA+d2jeU+VpOOGy/0MIFWMbafpFzblG3T+fARSBNH86n00qTy0Ing/NTm5B4Hk c7kldEPd+rUjgN0NCDR1znB46L3zIsrqwwnHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=eEXnRG6fwbdSe7u8k252ZS347gvsoZC3kPCR4r5PSOC9V7O+NdNpmycfmM5m3mmU1H 57IS2J0rXIGzlIclPTrHn/EyNsX7vnQsqt0ytHlJBtKZ5e1vImIamPnuQN3a+3LaIAGE yeHHxiuLT5tRgpaTYCGwc2Lh7S4qnxvefCtik= Original-Received: by 10.216.171.207 with SMTP id r57mr2284253wel.146.1267530484787; Tue, 02 Mar 2010 03:48:04 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:72300 Archived-At: --0016367fa8f549aa580480cff0a8 Content-Type: text/plain; charset=ISO-8859-1 I'm not sure how that would help me? Do you mean something like this? (let ((var "some variable")) (call-process "emacs" nil "*scratch*" t "-Q" "--batch" "-l" "~/test.el")) Using *call-process* would reset the state, but how do I reach *var* in * test.el*? I thought that was what you meant with dynamic scoping? On Tue, Mar 2, 2010 at 11:18 AM, Lennart Borgman wrote: > On Tue, Mar 2, 2010 at 12:03 PM, Johan Andersson > wrote: > > You mean like this? > > (setq var "some value...") > > (let ((var "some other value...")) > > ;; Use var with some other value > > ) > > ;; Use var with original value > > That would only work if I knew the variable names that I would set in the > > test, right? And that wont work... > > Yes, you are right. However that is not a serious problem (as long as > you are not testing display things). You can always collect the result > to your current Emacs. > > For an example of how to implement this see for example > web-vcs-byte-compile-file in nXhtml. (Which essentially just locates > the current Emacs executable and calls call-process.) > > > > On Tue, Mar 2, 2010 at 10:50 AM, Lennart Borgman < > lennart.borgman@gmail.com> > > wrote: > >> > >> On Tue, Mar 2, 2010 at 11:41 AM, Johan Andersson < > johan.rejeep@gmail.com> > >> wrote: > >> > Hey, > >> > I'm looking for a way to reset Emacs. By reset I mean like something > you > >> > would want to do in a testing framework. So if you set a variable in > one > >> > test, it will not be set in the next. > >> > The only way I find this possible is to run each test as a Emacs Batch > >> > script: > >> > (dolist (test tests) > >> > (shell-command "./run-test")) > >> > I guess that would work. However, there is a problem with > this. run-test > >> > does not have the test object. I could solve that by for each test > >> > output > >> > the object to a file and then read it in run-test. > >> > This solution seems rather clumpy though and I'm wondering if you can > >> > think > >> > of any good way to do it. > >> > >> > >> Dynamic scoping? > > > > > --0016367fa8f549aa580480cff0a8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm not sure how that would help me? Do you mean something like th= is?
=A0=A0(let ((var "some variable"))
= =A0=A0 =A0(call-process "emacs" nil "*scratch*" t "= ;-Q" "--batch" "-l" "~/test.el"))

Using call-process=A0would reset the state, but = how do I reach var=A0in=A0test.el? I thought that was what yo= u meant with dynamic scoping?


On Tue, Mar 2, 2010 at 11:18 AM, Lennart Borgman <lennart.borgman@gmail.com><= /span> wrote:
On Tue, Mar 2, 2010 at 12:03 PM, Johan Andersson <johan.rejeep@gmail.com> wrote:=
> You mean like this?
> =A0=A0(setq var "some value...")
> =A0=A0(let ((var "some other value..."))
> =A0=A0 =A0;; Use var with some other value
> =A0=A0 =A0)
> =A0=A0;; Use var with original value
> That would only work if I knew the variable names that I would set in = the
> test, right? And that wont work...

Yes, you are right. However that is not a serious problem (as long as=
you are not testing display things). You can always collect the result
to your current Emacs.

For an example of how to implement this see for example
web-vcs-byte-compile-file in nXhtml. (Which essentially just locates
the current Emacs executable and calls call-process.)


> On Tue, Mar 2, 2010 at 10:50 AM, Lennart Borgman <lennart.borgman@gmail.com>
> wrote:
>>
>> On Tue, Mar 2, 2010 at 11:41 AM, Johan Andersson <johan.rejeep@gmail.com>
>> wrote:
>> > Hey,
>> > I'm looking for a way to reset Emacs. By reset I mean lik= e something you
>> > would want to do in a testing framework. So if you set a vari= able in one
>> > test, it will not be set in the next.
>> > The only way I find this possible is to run each test as a Em= acs Batch
>> > script:
>> > (dolist (test tests)
>> > =A0=A0(shell-command "./run-test"))
>> > I guess that would work. However, there is a problem with thi= s.=A0run-test
>> > does not have the=A0test object. I could solve that by for ea= ch test
>> > output
>> > the object to a file and then read it in run-test.
>> > This solution seems rather clumpy though and I'm wonderin= g if you can
>> > think
>> > of any good way to do it.
>>
>>
>> Dynamic scoping?
>
>

--0016367fa8f549aa580480cff0a8--