When I have entered some bad code and hit shift+enter before thinking about the perils of finite RAM my computer obviously starts suffering. I have found two options that usually lets me recover without rebooting or in other ways lose the entire notebook.
The first is to switch to a shell and kill -9 the PID of MathKernel process.
The other is to go to the menu Evaluation->Quit Kernel->Local (note that Alt+. and Alt+, are completely ignored by now), by the time I have reached that menu my computer is on its last breath and seconds are of utmost importance. It usually takes seconds just to render the "Do you really want to quit the kernel?" dialog box. I think I would have better success rate if it just quit the kernel as fast as possible. Can I disable this dialog box?
Answer
You can add this to your init file, (or just try it out for the current session). It will add a Quit to your key events. This Quit doesn't open a confirm dialog.
FrontEndExecute[
FrontEnd`AddMenuCommands["MenuListQuitEvaluators",
{MenuItem["AddMenu &Quit",
FrontEnd`KernelExecute[ToExpression["Quit[]"]],
MenuKey["q", Modifiers -> {"Control"}],
System`MenuEvaluator -> Automatic]}]]
ref. https://mathematica.stackexchange.com/a/6227/363
Alternatively, it can be added to MenuSetup.tr like so:
Menu["Quit Local",
{
MenuItem["Quit Kernel",
FrontEnd`KernelExecute[ToExpression["Quit[]"]],
MenuKey["q", Modifiers -> {"Control"}],
MenuEvaluator -> Automatic]
}]
Comments
Post a Comment