1
$\begingroup$

This is rather basic.

In an empty notebook I type in a single cell

BeginPackage["fun`"]
Unprotect @@ Names["fun`*"];
ClearAll @@ Names["fun`*"];
f::usage = "f[x]"
Begin["`Private`"]
f[x_] := Module[{}, Sin[x^2]];
End[]
Protect @@ Names["fun`*"];
EndPackage[]

I select the cell and change to become an initialization cell. When I save the notebook, there is the option to save it as an Mathematica package. But I have read somewhere that when you save it for the first time it should appear a pop-up men asking about an AUTO SAVE choice.

But, this menu does not appear. Any ideas?

EDIT There is an answer to a similar query here

SetOptions[Notebooks["<notebook name>.nb"][[1]],AutoGeneratedPackage->Automatic]

Strangely:

This function has not been fully integrated into the long-term Wolfram Language, and is subject to change.

AutoGeneratedPackage is an option for notebooks that specifies whether a package is automatically created when a notebook that contains initialization cells or groups is saved.

(...since 1999...)

$\endgroup$
  • $\begingroup$ IMO, this question is better asked of Wolfram Research than asked here. It may be that the behavior you allude to changed when WRI added (in V6?) a template for creating packages to Mathematica (File > New > Package). I recommend using this template to build a package than converting notebooks. $\endgroup$ – m_goldberg Oct 2 '15 at 19:36

Browse other questions tagged or ask your own question.