MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Viewing packages in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102743] Re: [mg102739] Re: Viewing packages in mathematica
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 25 Aug 2009 01:45:18 -0400 (EDT)
  • References: <200908241155.HAA14164@smc.vnet.net> <2633821.1251135079233.JavaMail.root@n11>

Ok, thanks John. I'm slowly learning this but it seems I have to stumble on
everything.

Within Workbench one can edit a package.m file by opening with the System
Editor, which I guess is the FE package editor. Then it is possible to add
Titles, Sections, Text cells etc. The result is that it can look pretty much
like a regular notebook. One can select all the Code cells and switch them
to Input cells, which will have line wrapping, edit them, and then switch
back.

The FE editor comes up in a window outside of the Workbench panel, and the
editing is really being done outside of Workbench. Therefore, when one is
finished, Workbench says that the file is out of sync with the project
because it has been changed outside of the project. Therefore one has to
"Refresh" the package, or maybe one can "Refresh" the entire project. Then
Workbench will work properly. And InfoPaclet.m files will also display
properly.

One could also open the package again within Workbench by using the
Mathematica Source editor. The advantage of this is that you can have a
package that looks like regular notebooks and can be edited with either
editor.

One can generate a package.nb notebook by copying all the content in the
package.m file, say in the FE editor, and pasting it into a regular
notebook. Then select all the Input cells and convert them to StandardForm.
And conversely, one can generate a package.m file from the package.nb
notebook by opening a new package.m file, copying everything in package.nb
and pasting it into package.m. Then select all the Input cells and convert
their Style to Code cells. (Of course, one could also use the auto generate
mechanism.)

So it seems you can have your cake and eat it too. One just has to know how
to go back and forth and remember to Refresh.

So my love-hate relationship with Workbench is presently back in the love
phase. Until the next stumble.

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  
 

From: John Fultz [mailto:jfultz at wolfram.com] 

On Mon, 24 Aug 2009 07:55:59 -0400 (EDT), David Park wrote:
> I wasn't aware that all those features are built into the front end
> package editor.
>
> But how do I find out information on using the .m file and editing it
> because when I search the Documentation Center I find practically nothing.
>
> If I copy a notebook package contents and paste into a new .m file it
> looks almost like the notebook. Except it has "Input" cells instead of
> "Code" cells. What is the difference between these cell types? I looked
> up Code Cells in the DC but found nothing.

Code cells actually form the package code.  Input cells remain evaluatable
in
the FE, but are commented out in the package so that they are not evaluated
by
Get[].

The styles behind the scenes do this by setting (or not) the
InitializationCell
option, so it's basically the same as working with auto-generated packages
in a
regular notebook.

> You say the files from the package editor are interchangeable with
> Workbench. How so?

Package files are text files.  Since the package editor uses the text format
directly, rather than backing a source notebook file with a generated
package
file like auto-generated packages do, this means that you can edit those
package
files with anything.  The FE adds a small amount of markup, but that markup
is
in clearly delineated comments which often actually help to annotate the
file
when it's edited with any other editor.  And if you manually remove or alter
the
markup, the FE won't (or shouldn't, anyway) throw a conniption.


> I went to one of my Workbench projects, took one of
> the package files and opened with the System Editor and got the front end
> editor. Fine. But after I did that I no longer could properly open the
> PacletInfo.m file. It wouldn't even open after I tried to open with the
> PacletInfo Editor. My whole project is presently messed up! Or maybe all
> my projects are messed up and I don't know what is the best method to
> reconstruct them.

I can't say what happened here.  Your description is too vague, and I don't
really know anything about the PacletInfo Editor.  But if you want to send
me
your files and describe to me in more detail exactly what it was you did,
I'll
certainly take a look at it.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: Re: Re: ParrallelDo and set::noval
  • Next by Date: Mathematica 7.0.0 running on Mac OSX Snow Leopard ?
  • Previous by thread: Re: Viewing packages in mathematica
  • Next by thread: Re: Viewing packages in mathematica