Thanks Elliot, that worked. Is there any way to encapsulate that text in a 
function or macro? Otherwise I can write a tiny function that loads it into 
the clipboard so that I can paste it into the top cell in each new 
notebook. 

Is there a variant on your Javascript calling method that would let me 
execute a “File / Download as / Python (.py)” command from an IJulia cell 
and specify the filename and path with a Julia string variable? Ideally, 
I'd like to keep standard .ipynb versions of notebooks that are not under 
version control (because they can contain large images, etc.) But I also 
would like to automatically save a snapshot of the code in all the input 
cells when the analysis session is complete; that file would only be used 
when trying to resurrect a previous analysis after the original notebook 
had been changed. We don't want to work with just the code-only versions of 
notebooks because it might take a lot of effort to regenerate all the 
intermediate figures for presentations etc if there are lots of steps in 
the analysis or time consuming operations.

What I imagine is adding something like a Julia “commit()” function call to 
the cell that generates the final figure and re-running that cell. That 
function would save a snapshot of just the notebook code into a folder that 
is under version control, trigger a Git commit operation and retrieve the 
new tag, then re-generate the final figure with the figure title updated to 
include the latest Git tag (and the notebook name). Then we could save the 
final figure in the main laboratory notebook and be sure that we could 
perform exactly the same analysis any time in the future. I haven't used 
the Julia GitHub package yet but I assume it will let me carry out the Git 
commit operation and retrieve the new tag. If not, I bet we could do this 
sort of thing using shell calls pretty easily. 

Reply via email to