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

Merged
merged 5 commits into from Oct 14, 2011

Projects

None yet

2 participants

@fperez
Member
fperez commented Oct 9, 2011

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
Member

Great! Did you see that I have changed some of the codemirror files?
I think the python.js is the most important one, but there may be
others in the python syntax subdir. Let me know if you want me to
look at this to help figure out what changes we need to port forward.

On Sun, Oct 9, 2011 at 4:43 PM, Fernando Perez
reply@reply.github.com
wrote:

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...

You can merge this Pull Request by running:

 git pull https://github.com/fperez/ipython codemirror

Or you can view, comment on it, or merge it online at:

 #850

-- Commit Summary --

  • Update CodeMirror code to v2.15
  • Do not use version # in codemirror directory name.
  • Update templates to new directory name for codemirror.

-- File Changes --

R IPython/frontend/html/notebook/static/codemirror/LICENSE (0)
R IPython/frontend/html/notebook/static/codemirror/README.md (0)
A IPython/frontend/html/notebook/static/codemirror/ipython-version-2.15 (0)
R IPython/frontend/html/notebook/static/codemirror/lib/codemirror.css (1)
R IPython/frontend/html/notebook/static/codemirror/lib/codemirror.js (211)
R IPython/frontend/html/notebook/static/codemirror/lib/overlay.js (2)
R IPython/frontend/html/notebook/static/codemirror/lib/runmode.js (0)
R IPython/frontend/html/notebook/static/codemirror/mode/css/css.js (6)
R IPython/frontend/html/notebook/static/codemirror/mode/css/index.html (0)
R IPython/frontend/html/notebook/static/codemirror/mode/htmlmixed/htmlmixed.js (0)
R IPython/frontend/html/notebook/static/codemirror/mode/htmlmixed/index.html (0)
R IPython/frontend/html/notebook/static/codemirror/mode/javascript/index.html (0)
R IPython/frontend/html/notebook/static/codemirror/mode/javascript/javascript.js (8)
A IPython/frontend/html/notebook/static/codemirror/mode/markdown/index.html (340)
A IPython/frontend/html/notebook/static/codemirror/mode/markdown/markdown.css (10)
A IPython/frontend/html/notebook/static/codemirror/mode/markdown/markdown.js (230)
R IPython/frontend/html/notebook/static/codemirror/mode/python/LICENSE.txt (0)
R IPython/frontend/html/notebook/static/codemirror/mode/python/index.html (2)
R IPython/frontend/html/notebook/static/codemirror/mode/python/python.js (65)
R IPython/frontend/html/notebook/static/codemirror/mode/rst/index.html (1)
R IPython/frontend/html/notebook/static/codemirror/mode/rst/rst.css (0)
R IPython/frontend/html/notebook/static/codemirror/mode/rst/rst.js (0)
R IPython/frontend/html/notebook/static/codemirror/mode/xml/index.html (0)
R IPython/frontend/html/notebook/static/codemirror/mode/xml/xml.js (8)
R IPython/frontend/html/notebook/static/codemirror/theme/default.css (1)
R IPython/frontend/html/notebook/static/codemirror/theme/elegant.css (0)
R IPython/frontend/html/notebook/static/codemirror/theme/ipython.css (1)
R IPython/frontend/html/notebook/static/codemirror/theme/neat.css (0)
R IPython/frontend/html/notebook/static/codemirror/theme/night.css (0)
M IPython/frontend/html/notebook/templates/notebook.html (24)

-- Patch Links --

 https://github.com/ipython/ipython/pull/850.patch
 https://github.com/ipython/ipython/pull/850.diff

Reply to this email directly or view it on GitHub:
#850

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@fperez
Member
fperez commented Oct 11, 2011

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
Member

Your going to hate me...

On Mon, Oct 10, 2011 at 5:05 PM, Fernando Perez
reply@reply.github.com
wrote:

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?

No, unfortunately its looks like the changes got absorbed into the
last CM update. The only way to detect this is to start doing manual
diffs in the themes and python subdirs for changes that look like we
might have made them. It wouldn't be hard for me to do this...if I
had any dev time to spare...

IIRC, the changes are very minor, maybe 1-2 in python.js and possible
some in the themes, but those may be in the ipython.css theme file.

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.

Reply to this email directly or view it on GitHub:
#850 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@fperez
Member
fperez commented Oct 11, 2011

On Mon, Oct 10, 2011 at 7:31 PM, Brian E. Granger
reply@reply.github.com
wrote:

Your going to hate me...

Nah, you've got karma to spare :)

No, unfortunately its looks like the changes got absorbed into the
last CM update.  The only way to detect this is to start doing manual
diffs in the themes and python subdirs for changes that look like we
might have made them.  It wouldn't be hard for me to do this...if I
had any dev time to spare...

Actually, wouldn't it be easier instead to simply copy 2.12 fresh from
the download repo, and do a diff on that? Basically, on master:

  • download 2.12, and overwrite any files in our cm-2.12 dir with clean ones.
  • ask for a reverse diff.

That should do it. If git doesn't do reverse diffs, then it's just a
matter of (in a throwaway branch):

  • commit these changes
  • immediately do a 'git revert HEAD^'

that will generate precisely a commit with the diff we're looking for.

I can do that later if you're swamped right now...

@ellisonbg
Member

On Mon, Oct 10, 2011 at 7:50 PM, Fernando Perez
reply@reply.github.com
wrote:

On Mon, Oct 10, 2011 at 7:31 PM, Brian E. Granger
reply@reply.github.com
wrote:

Your going to hate me...

Nah, you've got karma to spare :)

No, unfortunately its looks like the changes got absorbed into the
last CM update.  The only way to detect this is to start doing manual
diffs in the themes and python subdirs for changes that look like we
might have made them.  It wouldn't be hard for me to do this...if I
had any dev time to spare...

Actually, wouldn't it be easier instead to simply copy 2.12 fresh from
the download repo, and do a diff on that?  Basically, on master:

  • download 2.12, and overwrite any files in our cm-2.12 dir with clean ones.
  • ask for a reverse diff.

That should do it.  If git doesn't do reverse diffs, then it's just a
matter of (in a throwaway branch):

  • commit these changes
  • immediately do a 'git revert HEAD^'

that will generate precisely a commit with the diff we're looking for.

I can do that later if you're swamped right now...

That would be great as I am completely swamped.

Reply to this email directly or view it on GitHub:
#850 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@fperez
Member
fperez commented Oct 14, 2011

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
Member
fperez commented Oct 14, 2011

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
Member
fperez commented Oct 14, 2011

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

Thanks for the feedback!

@ellisonbg
Member

Great, thanks for taking the time to do this!

On Thu, Oct 13, 2011 at 7:58 PM, Fernando Perez
reply@reply.github.com
wrote:

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.

Reply to this email directly or view it on GitHub:
#850 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@fperez
Member
fperez commented Oct 14, 2011

@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
Member

Oh yes, this look fine now. Thanks!

On Fri, Oct 14, 2011 at 12:52 PM, Fernando Perez
reply@reply.github.com
wrote:

@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 :)

Reply to this email directly or view it on GitHub:
#850 (comment)

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@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