5
$\begingroup$

Earlier today I was using Mathematica when I realized the definite integral Input Alias (typed as esc dintt esc) was missing. Upon further investiation I also noticed that similar aliases like sumt, dt, etc are also missing. Additionally when I run Options[SelectedNotebook[], InputAliases] in any notebook I get the following output.

Notebook InputAliases

Instead of the expected output described in this doc page for InputAliases:

Proper InputAliases

The InputAliases that is being loaded is from something I did a while back where I added code to make a numeric integral Alias to my init.m file. Assuming this was the issue, I went through and restored all the init.m files discussed in the doc page for init.m. However, even after removing the code for the ndint alias I added, the issue persisted. What's even more strange is that I remember having this same issue not long after I first added the ndint alias but it resolved itself after a while, and has just now come back.

I'm aware I could probably manually fix the issue by adding code to init.m that replaces the proper InputAliases. But that seems like a bad solution if additional aliases are added in future versions.

Finally, it is also possible I added this code to another file somewhere on my system, aside from an init.m file and just forgot? But I'm not sure what other files run when Mathematica starts. So perhaps anyone knowing of an exhaustive list of all files that could be overwriting the InputAliases would be most helpful to me and anyone else with similar problems?

$\endgroup$

1 Answer 1

3
$\begingroup$

TL;DR Deleting the init.m file stored at $UserBaseDirectory/FrontEnd should fix the issue

After further tinkering I was able to fix the issue by deleting the init.m file at $UserBaseDirectory/FrontEnd and restarting mathematica. I had previously looked in this file but assumed it was automatically generated. To anyone having the same or similar issues I would recommend deleting or re-naming all the init.m files in the following locations in order to be absolutely sure none of them are breaking your InputAliases:

\$BaseDirectory/Kernel/init.m

\$UserBaseDirectory/Kernel/init.m

\$BaseDirectory/FrontEnd/init.m

\$UserBaseDirectory/FrontEnd/init.m

Update:

I've also managed to find the cause of the problem, and as it turns out it had nothing to do with the custom alias I described in the question. The culprit was the AddCodeCompletion resource function. When the resource function is referenced as ResourceFunction["AddCodeCompletion"] there aren't any issues, but pasting the following code from the source notebook will replace all of your InputAliases with {InputAliases -> {"rg" -> "»"}} and also changes the init.m file stored at $UserBaseDirectory/FrontEnd so that they re-break every time you restart Mathematica.

To anyone skimming this thread - DO NOT RUN THIS CODE

AddCodeCompletion[function_String][args___] := Module[{processed}, processed = {args} /. {None -> 0, "AbsoluteFileName" -> 2, 
 "RelativeFileName" -> 3, "Color" -> 4, "PackageName" -> 7, 
 "DirectoryName" -> 8, 
 "InterpreterType" -> 9}; (FE`Evaluate[
  FEPrivate`AddSpecialArgCompletion[#1]] &)[function -> processed]]

I have absolutely zero idea why this happens, but I've repeated it several times now and am 100% sure it was the cause. So hopefully this is helpful to anyone else who a may have broken their aliases messing with FEPrivate functions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.