再会,
这个问题来自关于aborting evaluation of the full sequence of inputs的问题。
我认为可以通过重新定义FrontEndEventActions
两个事件来实现所需的行为:("EvaluateCells"
或按Shift+ Enter)和按Alt+ .。它应该是这样的:
SetOptions[$FrontEndSession,
FrontEndEventActions -> {"EvaluateCells" :> Last$PreRead,
{{"Alt", "."} :> AbortAllNextInputs}}]
或者
SetOptions[$FrontEndSession,
FrontEndEventActions -> {{{"ShiftKey", "ReturnKeyDown"} :> Last$PreRead}
{{"Alt", "."} :> AbortAllNextInputs}}]
其中AbortAllNextInputs
和Last$PreRead
定义如下:
AbortAllNextInputs := AbortProtect[
$new$PreRead = True;
last$PreRead = ToString[Definition[$PreRead], InputForm];
ClearAll[$PreRead];
$PreRead := # &] /; ! TrueQ[$new$PreRead]
Last$PreRead :=
$PreRead := AbortProtect[
$new$PreRead = False;
ClearAll[$PreRead];
If[last$PreRead === "Null", #,
ToExpression[last$PreRead]; $PreRead@#]
] &
但我无法FrontEndEventActions
工作。谁能帮我?