5

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?

Community
  • 1
  • 1
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93

1 Answers1

1

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

Community
  • 1
  • 1
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
  • I have created [another question](http://stackoverflow.com/questions/5676911/) on this method. I think these approaches both are very valuable and must be separated. – Alexey Popkov Apr 15 '11 at 12:46