[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: in batch or during test
From: |
Rusi |
Subject: |
Re: in batch or during test |
Date: |
Tue, 21 Apr 2015 05:08:20 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Tuesday, April 21, 2015 at 4:43:09 PM UTC+5:30, Phil Lord wrote:
> Is there a way to discover if Emacs is being run in batch and/or running
> a test?
>
> I have a package that uses "after-change-functions" and several other
> "self-niling" hooks. If I have a bug in my package, the hook function
> automatically gets removed, leaving the package in an inconsistent state
> (because one hook may have gone but the others remain). So instead I use
> "condition-case" to catch any errors and disable the entire package
> (i.e. all of the hook functions) if an error occurs.
>
> This works well, but unfortunately effectively swallows the backtrace.
> Particularly annoying when I am running automated tests. So, I want to
> write a macro like `condition-case-unless-debug' but which is "unless
> running in batch or running ert". But I don't know how to find out if I
> am in batch or running ert!
>
> Phil
Maybe you want the variable 'noninteractive'?
(info "(elisp)batch mode")