12
$\begingroup$

Bug introduced in 10.3 or earlier and fixed in 11.1


Reproduced on Windows 7, 10

Bug confirmed by WRI:

[...] It does appear that the Saveable Notebook Option on Windows is not behaving properly, and I have forwarded an incident report to our developers with the information you provided. [...]


I'm having difficulties with programmatic creation of non saveable notebooks on Windows with V10.4.1. while I believe it was working in the past.

path = FileNameJoin[{$HomeDirectory, "Desktop", "test.nb"}];

Export[
    path,
    Notebook[{}, Saveable -> False ],
    "NB"
]

NotebookOpen @ path;

Now write something there, menu item File > Save is inactive but use Ctrl+S and close the notebook. Open again:

NotebookOpen @ path;

and the edited content is there. (that is unexpected)

With the setting Saveable->False, a notebook cannot be saved using File > Save or the equivalent keyboard shortcut.

On the other hand edited Help notebooks are not preserving changes....

What have I missed? How are they different?


Further investigation about Help notebooks.

As mentioned before, they appear to behave correctly. Also their menu is different than menu of just Saveable->False notebook:

enter image description here

Save As.. item is pale too...

But go to any Help notebook and evaluate e.g:

path = FileNameJoin[{$HomeDirectory, "Desktop", "plotRef.nb"}]

CopyFile[ NotebookFileName[], path ]

NotebookOpen @ path

The same help notebook opened from desktop is not behaving correctly anymore!

$\endgroup$
  • 2
    $\begingroup$ Sounds like it might be a bug, your procedure acts as you expect it to on my system i.e. I can't save changes. MMA 10.0.1.0 OSX 10.10.5 Maybe bug is too strong a word, since the docs say it's subject to change. $\endgroup$ – N.J.Evans Apr 28 '16 at 15:20
  • 1
    $\begingroup$ It is not possible to Save with the shortcut for me also (it works as expected) with v10.3.1/v10.4.1 with OSX 10.9.5. It seems an OS specific problem. $\endgroup$ – SquareOne Apr 29 '16 at 8:23
11
$\begingroup$

To whom it may concern, a workaround:

path = FileNameJoin[{$HomeDirectory, "Desktop", "testWorking.nb"}];

nb = Notebook[{},
   Saveable -> False,
   NotebookEventActions -> {{"MenuCommand", "Save"} :> {}} (*the fix*)
];

Export[path, nb, "NB"]
$\endgroup$
  • $\begingroup$ Thx a lot. So you're overwriting the even actions list where the shortcut Ctrl+S would be defined right? $\endgroup$ – A. Vieira Nov 11 '17 at 10:24

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.