You can clone with
I had used in console the store command to store macros for multiple sessions. I noticed this has been removed in the console and in qtconsole in 0.11. I haven't seen anything to store macros persistently across sessions so I am guessing this is a regression that should have made it into 0.11 but didn't for one reason or another.
We do intend to restore %store or something equivalent before the next release, I think.
That'd be great. Is there anything similar one can do now to keep macros between sessions. Like a function to declare a macro that could be loaded on ipython startup.
If you use the new config files, and find exec_lines, you can store the code in a string and call %macro, something like this:
...exec_lines = ["""mymacrocode = "print 'Hello world!'" """,
"""%macro mymacro mymacrocode"""]
I haven't tested this, but it should work. I don't think there's a way to interactive store a macro, though.
I used store a lot. Guess I'm going back to the old ipython for now.
Sorry no-one's got round to bringing it back yet. If either of you would like to work on it, you'll need to update the quarantined pspersistence module to the new API. Its current code is here:
We can of course provide more information if you want to ask questions on the mailing list.
I'm not sure if there is a neat source for what changed, unfortunately. At a brief glance, I think the only thing that changes is how we register magics. Have a look at how it's done for history: https://github.com/ipython/ipython/blob/master/IPython/core/interactiveshell.py#L1875
Also, if you're interested in persistence, I wrote down a few thoughts about what we might do in the future. In particular, using dill (an extension to pickle) might be interesting, because we could store objects like functions which we can't currently.
%store is now back in an extension for 0.12. To load it, do %load_ext storemagic. To have it always loaded, add 'storemagic' to the list c.InteractiveShellApp.extensions in your ipython_config.py file.
Sorry!! For some reason it didn't work at first try for storing macros that were defined but restarted and now it's a go. THANKS FOR THE HARD WORK!!!!!!