[IPython-dev] comment on autosave
Zoltán Vörös
zvoros at gmail.com
Wed Nov 7 09:31:26 EST 2012
Hi Matthias,
Thanks for the comments, and I see the problems. As for overwriting the
file, I had the impression that the problem was that some people don't
want to bother about pressing Cntr-S. In that case, the file is
overwritten anyway, so my suggestion was really just to make this
mechanism automatic, without having to explicitly hit Cntr-S.
But since you have already proposed a solution in your mail on the user
list, I wonder there would still be any point in implementing
"write-to-disc-when-executing-cell".
Cheers,
Zoltán
On 11/07/2012 03:28 PM, Matthias BUSSONNIER wrote:
> Hi Zoltán,
> Le 7 nov. 2012 à 11:39, Zoltán Vörös a écrit :
>
>> Hi all,
>>
>> I might be poking into a hornets' nest, but I was wondering whether
>> configurably linking saving the notebook to the cell execution could
>> appease all those who complain about autosave. My idea is that one could
>> simply have a flag in the profile, and if that flag is set, then
>> that.save_notebook() could be executed at the end of
>> execute_selected_cell(). This solution should be safe in the sense that
>> as long as the function save_notebook works, there should be absolutely
>> no problems with using it in execute_selected_cell, and we wouldn't have
>> to tamper with the javascript base.
>>
>> In any case, if you think this could be a viable option, I could try to
>> implement it.
> Thanks for the suggestion,
> It is a good idea, but the problem is there is no good way yet to propagate configuration to the JS side except from the custom.js in user profile.
>
> you could listen to event 'execution_request.Kernel' and 'shell_reply.Kernel' for code execution.
> I don't remember the name of the event for MD cell rendering or even if there is one.
> (this could be added)
>
>
> This should be a one liner in custom.js like :
>
> $([IPython.event]).on('shell_reply.Kernel',IPython.notebook.save_notebook);
>
> I would just warn you that it does overwrite the current version of the file, whereas what you might wish is a secondary file with another name.
> save can take a name parameter, but then it renames the notebook instead of doing a copy so be carefull.
>
> We'll be really happy if you find a good way of propagating option from profile/command line to the browser side, or at least open an IPep about that :-)
>
> If you came up with anything you can add it to the wiki :-)
More information about the IPython-dev
mailing list