How to abort evaluation of a sequence of inputs?

前端 未结 3 997
北海茫月
北海茫月 2020-12-10 19:57

By default pressing Alt+. or calling Abort[] within the evaluation causes abort of the currently evaluating input. But when working in the

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 20:39

    Alexey, please try this version of your code and tell me if/when it fails:

    AbortAllPendingInputs :=
      AbortProtect[
        $new$PreRead = True;
        $TimeOfAbort = SessionTime[];
        last$PreRead = $PreRead;
        $PreRead = 
          If[
             TrueQ[SessionTime[] - $TimeOfAbort < 1], 
             "",
             $new$PreRead = False; $PreRead = last$PreRead; $PreRead[#]
            ] &;
      ] /; ! TrueQ[$new$PreRead]
    

提交回复
热议问题