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 <lennart.borgman@gmail.com> wrote:
On Tue, Mar 2, 2010 at 12:03 PM, Johan Andersson <johan.rejeep@gmail.com> 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?
>
>