These are chat archives for ipython/ipython

16th
Mar 2015
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:07
any thoughts on why I'd be seeing a default indentUnit of 2 for codemirror on master?
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:13
looks like CodeCell.options_defaults should maybe extend Cell.options_defaults
or just specify its own indentUnit...
Matthias Bussonnier
@Carreau
Mar 16 2015 20:21
...hum, weird.
shouldn't be 2.
there were some change in options recently.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:22
2 has been CM default for some time
Matthias Bussonnier
@Carreau
Mar 16 2015 20:24
like a week ? Or more ?
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:24
2012
Matthias Bussonnier
@Carreau
Mar 16 2015 20:24
o_0 ?
in Python code cell ?
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:24
nah, i mean, lib/codemirror.js
Matthias Bussonnier
@Carreau
Mar 16 2015 20:25
Ah, you want to change codemirror default from 2 to 4?
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:25
well, CodeCell has a python-centric default of 4
sry, cell
is ConfigWithDefaults aware of superclasses?
Matthias Bussonnier
@Carreau
Mar 16 2015 20:27
Cell is kinda aware, not really, but config on Cell, should affect CodeCell.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:28
hm... don't see where that would go
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:30
yeah, that's what we'd like to have "inherited"
Matthias Bussonnier
@Carreau
Mar 16 2015 20:30
It shoudl inherit does it not ?.
Oh, wait, you want ipython/ipython#8045
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:32
likely related!
but the contents of this.class_config.get_sync('cm_config') never reflect inherited values: https://github.com/ipython/ipython/blob/master/IPython/html/static/notebook/js/codecell.js#L166
Matthias Bussonnier
@Carreau
Mar 16 2015 20:34
yep, that's one of the things what's above should fix.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:34
ah, ok
Matthias Bussonnier
@Carreau
Mar 16 2015 20:34
point beeing that get_sync() only fetch from disk.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:35
but i see that might be slated for 4.0
near term, master gives you indent of 2, which is surprising
Matthias Bussonnier
@Carreau
Mar 16 2015 20:36
Yeah, cause that might break API.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:38
so, could near term https://github.com/ipython/ipython/blob/master/IPython/html/static/notebook/js/codecell.js#L107 be
config: $.extend({}, Cell.options_default, CodeCell.options_default),
You pass config: $.extend({}, CodeCell.options_default), to Cell which merge with it's own options.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:46
ah, but then those don't get picked up by get_sync
Matthias Bussonnier
@Carreau
Mar 16 2015 20:46
No, get sync only return the config on disk, not the default value.
IIRC.
so what you want is extend(get_sync, default)
get_sync is basicaly the value of ~/.ipython/profile_default/nbconfing/notebook.json
the reason with config, you can do get_sync(), or update() and update should only change user value
not default in class.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 20:48
ok. so is it a bug that by default, new CodeCell.code_mirror are currently starting with an indentUnit of 2?
if it is a bug, and #8045 will be merged, then i'll go about my business :)
Matthias Bussonnier
@Carreau
Mar 16 2015 21:00
IPython.notebook.get_selected_cell().code_mirror.getOption('indentUnit') -> 4
it does work here.
can you try on tmpnb ?
cause I've never seen an indent Unit of 2.
Could it be your config ?
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:01
this is on a freshly-built docker box
inside a freshly built vagrant environment
Matthias Bussonnier
@Carreau
Mar 16 2015 21:02
hum...
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:03
tmpnb is still showing this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
vs master
this.code_mirror = new CodeMirror(input_area.get(0), this.class_config.get_sync('cm_config'));
Thomas Kluyver
@takluyver
Mar 16 2015 21:05
If it's using get_sync() and there is some config, there's a race condition for whether that config has arrived before the cell is created.
but if there's no config, that shouldn't affect it.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:06
but how would class_config know about Cell?
i don't see anything in there about checking inheritance
Matthias Bussonnier
@Carreau
Mar 16 2015 21:06
So that just master, that's not since 2012
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:07
yeah, just master... Codemirror's default is 2, since 2012
so that's what's showing up
Matthias Bussonnier
@Carreau
Mar 16 2015 21:07
Ok, sure, missunderstanding.
that a recent change on master.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:08
ok, sounds good
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:14
checking...
yup does the job
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:20
this isn't ruining my day, so if we need to hold off for #8045, that's fine!
Matthias Bussonnier
@Carreau
Mar 16 2015 21:25
We like to ruin your day.
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:26
awwww
Matthias Bussonnier
@Carreau
Mar 16 2015 21:27
:-P
Sorry, JS is ruining mine, and Python packaging Thomas' , so we need to compensate :-)
Nicholas Bollweg
@bollwyvl
Mar 16 2015 21:29
well, the aforementioned docker and vagrant are the true culprits in my ruination