Update codemirror to 2.15 and make the code internally more version-agnostic #850

Merged
merged 5 commits into from Oct 14, 2011

2 participants

@fperez
IPython member

Just updated to the recently released CM and changed things around a little so that we don't have an explicit version number path inside our templates.

Since 0.12 may live for a while in a long-term Ubuntu release (12.04), it would be nice to release with the most updated CM...

fperez added some commits Oct 9, 2011
@fperez fperez Update CodeMirror code to v2.15 6652b19
@fperez fperez Do not use version # in codemirror directory name.
Simply call it 'codemirror', so we don't have explicit version numbers
inside a bunch of files.

A file called ipython-version-N.NN will be kept to easily let us know
which version we're shipping with IPython.
265d40c
@fperez fperez Update templates to new directory name for codemirror. 5b206ff
@ellisonbg
IPython member
@fperez
IPython member

No, I hadn't realized that you had made changes. If they were made in a single commit, then it should be relatively easy to reapply them as a patch, do you have the commit number?

And what I can do is apply them again as a single commit and record that info in a little README, so that it's easy later to apply again when we upgrade CM. Eventually the right way to do this is to keep the patch set separately using something like stgit, but for small changes we can get away with a one-off manual process.

@ellisonbg
IPython member
@fperez
IPython member
@ellisonbg
IPython member
@fperez
IPython member

Found it, the only difference from CM 2.12 and your code is this:

diff --git a/IPython/frontend/html/notebook/static/codemirror-2.12/mode/python/python.js b/IPython/frontend/html/notebook/static/codemirror-2.12/mode/python/python.js
index baeec03..0cda2aa 100644
--- a/IPython/frontend/html/notebook/static/codemirror-2.12/mode/python/python.js
+++ b/IPython/frontend/html/notebook/static/codemirror-2.12/mode/python/python.js
@@ -5,7 +5,7 @@ CodeMirror.defineMode("python", function(conf) {
         return new RegExp("^((" + words.join(")|(") + "))\\b");
     }
     
-    var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
+    var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\\?]");
     var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
     var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
     var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))")

It's a single line change where you added some operators. I'm now going to see how much of that is actually even needed in 2.15, since they've also updated the python code somewhat.

So this is going to be pretty easy, in fact.

@fperez
IPython member

OK, @ellisonbg, I've applied back the changes you had, and it was done as a single-commit in bef6551 so we can find them again easily later on. If this ever gets big we can make a little patch queue for it, but something this small is just as easily copy/pasted by hand, esp. now that it's in its own commit and hence easy to find.

I'll make a little file with this info so we know what to do in future updates too.

@fperez
IPython member

OK, ipython-specific readme added, let me know if you see anything else that sticks out prior to merge.

Thanks for the feedback!

@ellisonbg
IPython member
@fperez
IPython member

@ellisonbg, does this look OK to merge, or do you want anything else on it? Just being a good citizen here and not merging my own stuff without someone else giving the final OK :)

@ellisonbg
IPython member
@fperez fperez merged commit e5a1dff into ipython:master Oct 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment