From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rusi Newsgroups: gmane.emacs.help Subject: Re: in batch or during test Date: Tue, 21 Apr 2015 05:08:20 -0700 (PDT) Message-ID: <8c9c772b-9c7a-45f8-8cb8-b4626cc7effc@googlegroups.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1429618222 29587 80.91.229.3 (21 Apr 2015 12:10:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Apr 2015 12:10:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 21 14:10:22 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YkX0O-0001Nu-Jo for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2015 14:10:20 +0200 Original-Received: from localhost ([::1]:58236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkX0O-0008RL-1F for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2015 08:10:20 -0400 X-Received: by 10.182.246.67 with SMTP id xu3mr30186511obc.18.1429618101093; Tue, 21 Apr 2015 05:08:21 -0700 (PDT) X-Received: by 10.50.25.199 with SMTP id e7mr393321igg.16.1429618101073; Tue, 21 Apr 2015 05:08:21 -0700 (PDT) Original-Path: usenet.stanford.edu!news.glorb.com!m20no5126904iga.0!news-out.google.com!n7ni13066igk.0!nntp.google.com!l13no8119786iga.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=117.195.42.16; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 117.195.42.16 User-Agent: G2/1.0 Injection-Date: Tue, 21 Apr 2015 12:08:21 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:211621 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103902 Archived-At: 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")