How to redefine FrontEndEventActions?

戏子无情 提交于 2019-12-22 06:56:23

问题


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[$FrontEndSession, 
 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?


回答1:


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



来源:https://stackoverflow.com/questions/5673277/how-to-redefine-frontendeventactions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!