Hi, I am trying to create a CodeMirror mode for Maxima (a computer algebra system, project page: http://maxima.sourceforge.net) for use in the IPython notebook. From what I understand, IPython uses CodeMirror to highlight code in the notebook so I am just trying to extend that to Maxima code. I have already gotten the IPython front end to talk to a Maxima kernel (IPython back end) so that’s great.
I created a maxima.js mode file by modifying the existing Mathematica mode. Following instructions from IPython, I’ve put a statement to load maxima.js in the JS code which is always loaded by IPython.
From what I can tell, the attempt to load maxima.js (via jQuery getScript) succeeds. However, the CodeMirror.requireMode is either never called or fails, and there is no highlighting applied in the browser.
Can anyone think of something I can try to debug this? I know this is not much to go on, but unfortunately I don’t have a simple, reproducible example, as this stuff is a work in progress and has many dependencies which would make it very time consuming for anyone else to try.
For the record, here are the relevant lines from the code which is supposed to load maxima.js:
console.log ('HEY THIS IS THE SUPPOSED PER-PAGELOAD STUFF!!');
$.getScript('/static/components/codemirror/mode/maxima/maxima.js').done (function (script, textStatus) { console.log ('HEY APPARENTLY SUCCESSFUL GETSCRIPT FOR MAXIMA.JS; STATUS=' + textStatus); }).fail (function (jqhxr, settings, exception) { console.log ('HEY GETSCRIPT ERROR: ' + jqhxr + ', ' + settings + ', ' + exception); });
console.log ('HEY CODEMIRROR.MODEURL=' + CodeMirror.modeURL);
CodeMirror.requireMode('maxima', function(){
console.log('HEY MAXIMA MODE SHOULD NOW BE AVAILABLE IN CODEMIRROR.');
})
This is certainly a mess and I apologize for its terrible appearance. I do see the messages “PER-PAGELOAD STUFF”, “APPARENTLY SUCCESSFUL GETSCRIPT”, and “CODEMIRROR.MODEURL” in the web browser console, but I don’t see “MAXIMA MODE SHOULD NOW BE AVAILABLE”. (By the way, about the modeURL, it is indeed pointing to the location where maxima.js lives.)
I’ll let this be enough for now; I’ll be happy to post additional info as needed. Thanks for your time, and thanks for any light you can shed on this problem.
best,
Robert Dodier