[Cuis-dev] [NOOB] Why are editor windows non persistent?

Juan Vuletich juan at jvuletich.org
Tue Sep 15 06:42:23 PDT 2020


Hi Alexander,

Welcome to the Cuis community!
(inline)

On 9/15/2020 6:48 AM, Alexander Shendi via Cuis-dev wrote:
> Hi folks,
>
> As can be seen on /r/smalltalk I have managed to open an editor window 
> with the desired file contents. However, to my dismay, these windows 
> aren't persistent. When I save a new version of an image, the editor 
> windows are gone.
>
> I would like to know why. To the best of my knowledge (which may not 
> be much), the entire current state of the VM should be saved. 

You are completely right. They should be saved.

In Cuis, there are several ways to save the image, all in the World 
menu. The first 3 might overwrite the existing image file:
- Selecting 'Save' will overwrite the existing image file, the previous 
state (before startup) will be lost.
- If you select 'Save and Quit', the image file will be overwritten, as 
if selecting 'Save' and the system will exit.
- If you select 'Quit', the system will ask if you also want to save. If 
you answer yes, then the behavior is as selecting 'Save and Quit'. If 
you answer no, your session will be lost (but still the code you wrote 
can be recovered).
- Doing 'Save as...' will ask for a file name for the image file. This 
lets you avoid overwriting the existing image file.
All the previous save options will preserve the state of the image, 
including all the objects you created (and haven't been garbage 
collected), and any windows, including text editors.

- 'Save as New Version'. This option is a bit different. If you hover 
your mouse over it, you'll see a post-it note like help bubble, saying 
that user data will be lost.

Let's see how this is implemented. (Skip this paragraph if not 
interested.) Open a Workspace. Type 'Save as New Version' (without the 
quotes). Select the text. Now right click and select 'Method Source with 
it'. You'll get a list with two methods. One of them is 
#worldMenuOptions. Select it.You'll see that 2 lines below 'Save as New 
Version' it says #saveAsNewVersion. This is a symbol, a selector for a 
method. Double click to select that word, right click, select 
'implementors of it'. You'll see that the last line of this method does
     "Try to clear all user state, including all class vars, 
preferences, etc"
     self saveAs: newName andQuit: false clearAllClassState: true
The key here is the last parameter. This method is specifically asking 
for all state to be cleared.

This menu option is intended for developing Cuis itself. We use it to 
save the Cuis image file that is stored in the GitHub repo, that should 
only include the "default desktop", with the Taskbar, a Transcript, and 
an About Cuis window.

Alexander, Folks, would it be more clear if we rename it to 'Save as New 
Release' or 'Save as New Cuis Release'? Any other suggestion?

> I assume there are hooks to run user code after the image has loaded.

Yes, this is true, but unrelated to the problem you experienced. If you 
want, answer back telling a bit about your needs, as there are several 
ways to do that, and we'd like to give useful advice.

> Many thanks in advance.
>
> Best Regards,
> /Alexander
> -- 
> All is (void *) ; 

You're most welcome.

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list