1
$\begingroup$

I have an algorithm in a notebook that I don't want to change. I used it regularly. I'm afraid I might accidentally modify a parameter. I'd like the notebook to be executable, perhaps editable, but permanently unsaveable. I've tried to accomplish this by:

Preferences>Advanced>OptionsInspector>NotebookOptions>FileOptions>Savable->False

However, it appears that this setting is lost when I quit Mathematica. Is there a way to make it permanent?

$\endgroup$
3
  • $\begingroup$ @andre My gosh, you are right. Saving Savable->False is an oxymoron. I'll try SaveAs. If it works, then you deserve a correct answer point. $\endgroup$
    – Chris
    Dec 6 '20 at 19:24
  • $\begingroup$ I think there may be someone else, some day with the same question. $\endgroup$
    – Chris
    Dec 7 '20 at 23:08
  • $\begingroup$ A good way to achieve this effect is to write a Package. In this way, the definition of important functions is separated from their application. $\endgroup$
    – Roman
    Dec 8 '20 at 18:16
2
$\begingroup$

An extended comment...

I believe your post opens up the much larger question of refactoring code.

Martin Fowler wrote a brilliant book on the topic Refactoring - Improving the Design of Existing Code

The book addresses almost every conceivable way to protect the code that works and iteratively improve it.

Fowler (with Kent Beck) published the 2nd edition of this classic work in 2018.

It will make anyone that writes code in any language better at the craft of coding and leave the world with better code.


It also occurred to me to edit this post and recommend Martin Fowler's other books and contributions, e.g.:

Analysis Patterns and of course his work with both: Agile Software Development and Software Architecture.

All of Fowler's work has direct application in developing/writing/managing Mathematica code.

enter image description here

$\endgroup$
1
$\begingroup$

The setting is lost because precisely the notebook is not saveable (in this case, you will not be asked if you want save the notebook), because precisely you don't want it to be saved (!).

To force the saving use the menu "Save as...".

This is documented. Look "saveable" in the documentation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.