MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Abort computation on any message

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124937] Re: Abort computation on any message
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Mon, 13 Feb 2012 03:39:30 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jh2ti3$tc$1@smc.vnet.net> <jh82hg$oen$1@smc.vnet.net>

On 12/02/2012 09:59, David Bailey wrote:
> Unprotect[Message];
> pass = False;
> Message[mes_MessageName, args___] :=
>     Block[{pass = True}, Message[mes, args];
>       Abort[]] /; (Head[mes] === MessageName&&  ! pass);
> Protect[Message];

I discovered after posting this that this version will abort inside 
Quiet - here is a better version:


Unprotect[Message];
pass = False;
Message[mes_MessageName, args___] :=
    Block[{pass = True}, Message[mes, args];
      Abort[]] /; (Head[mes] === MessageName && ! pass);
Protect[Message];
Unprotect[Quiet];
Quiet[x___]:=Block[{pass=True},Quiet[x]]/;(!pass);
Protect[Quiet];

David Bailey
http://www.dbaileyconsultancy.co.uk



  • Prev by Date: Re: Setting global graphics options
  • Next by Date: Re: Setting global graphics options
  • Previous by thread: Re: Abort computation on any message
  • Next by thread: Run external programs in parallel on OSX