开发者

How to redefine FrontEndEventActions?

Good day,

This question comes from the question on aborting evaluation of the full sequence of inputs.

I think it is probably possible to achieve the desired behavior by redefining FrontEndEventActions for two events: "EvaluateCells" (or pressing Shift+Enter) and for pressing Alt+.. It should be something like:

SetOptions[$FrontEndSes开发者_如何学Csion, 
 FrontEndEventActions -> {"EvaluateCells" :> Last$PreRead, 
   {{"Alt", "."} :> AbortAllNextInputs}}]

or

SetOptions[$FrontEndSession, 
 FrontEndEventActions -> {{{"ShiftKey", "ReturnKeyDown"} :> Last$PreRead}
   {{"Alt", "."} :> AbortAllNextInputs}}]

Where AbortAllNextInputs and Last$PreRead are defined as follows:

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@#]
    ] &

But I can not get FrontEndEventActions working. Can anyone help me?


I believe you need to modify KeyEventTranslations.tr as referenced here and here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜