Re: command to save as .m file
- To: mathgroup at smc.vnet.net
- Subject: [mg113713] Re: command to save as .m file
- From: Sebastian <sebhofer at gmail.com>
- Date: Mon, 8 Nov 2010 05:40:06 -0500 (EST)
- References: <iatspo$eav$1@smc.vnet.net> <ib0l94$ghv$1@smc.vnet.net> <ib38uk$f37$1@smc.vnet.net>
On Nov 6, 10:59 am, David Bailey <d... at removedbailey.co.uk> wrote: > On 05/11/10 10:11, David Bailey wrote: > > > > > On 04/11/10 09:01, Sebastian wrote: > >> Hi, > >> I've been searching the newsgroup and the web for an answer for this, > >> but all the results were unsatisfactory: > >> Is there a way to save the currently opened .nbfileto a .mfileby > >> using a mathematica command and not the "Save as..." menu command? > >> Please note that I want _all_ the cells to be written to themfile, > >> not only the initialization cells. Even better would be a way to do > >> this on every save of the nb, but I have given up hope that such a > >> thing is possible. All this is part of my effort to find an effective > >> version control solution for my mathematica files. > >> TIA > >> Sebastian > > > It would definitely help to explain a bit about what you want to achiev= e. > > > However, you could read your notebook with NotebookGet, then write that > > messy structure to a .mfilewith Save. It would really help to > > understand how you want to use this. > > > David Bailey > >http://www.dbaileyconsultancy.co.uk > > Sorry, I realised after I had written this, that you had explained what > you are trying to achieve. I have a couple of extra suggestions: > > 1) I believe Wolfram Workbench supports version control, but I don't > use this because it seems to involve a steep learning curve and is not > particularly well integrated with Mathematica. > > 2) Notebooks are actually text files - try opening one with a text > editor. Therefore, it is possible to read a notebook as lines of text > from within Mathematica. > > David Baileyhttp://www.dbaileyconsultancy.co.uk Hi, thanks for your suggestions but they don't really achieve what I'm trying to do. Sorry if it wasn't clear what I was trying to do, so here goes again: By choosing "Save as..." from the file menu and then selecting "Mathematica Package (*.m)" I can save a real "plain text" file as opposed to a notebook (.nb) file, which has all these metainformation and a very "messy structure" as you called it. This I can easily check into a VC system, easily resolve merge conflicts and so on. The problem is, that sometimes I want to edit the notebook files as I want to keep certain output cells and I tend to forget to save it to a package file. Hope that clears things up! Sebastian