MathGroup Archive 2011

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

Search the Archive

Re: How to disable automatic clearing $MessageList after generating of output?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116956] Re: How to disable automatic clearing $MessageList after generating of output?
  • From: Alexey <lehin.p at gmail.com>
  • Date: Sat, 5 Mar 2011 06:08:38 -0500 (EST)

I have found the solution. It exploits elegant hack by Todd Gayley.
Here it is (of course, it must be evaluated in the slave kernel):

$globalMessageList = {};
Unprotect[Message];
Message[args___] :=
  Block[{$inMsg = True, $MessageList = $globalMessageList},
    Message[args];
    $globalMessageList = $MessageList;
    ] /; ! TrueQ[$inMsg];
Protect[Message];

One can fully emulate standard behavior of Messages in the slave
kernel by checking the current value of $Line and comparing it with
previous value:

If[TrueQ[$Line > lastLine],
 LinkWrite[$kern,
  Unevaluated[ExpressionPacket[$globalMessageList = {};]]];
 LinkRead[$kern]]; lastLine = $Line;

:)


  • Prev by Date: Using the compiled libraries (dll) outside mathematica
  • Next by Date: Re: Mathplayer on tablet device
  • Previous by thread: How to disable automatic clearing $MessageList after generating of output?
  • Next by thread: Re: Bug in definite integral over Gamma function?