Always auto save previously saved listers on close

For people like me who arrived here to search for solution to this problem, but did not found it (reference):

I have wrote a script which auto-saves any custom Listers/Layouts on closing them. It also disallow these custom Listers to be saved as the default one. To me, this should be a built-in function, however the script turned out to be easy:

// Called when a Lister is closed
function OnCloseLister(closeListerData)
{
    if (closeListerData.lister.layout != "")
    {
        closeListerData.prevent_save = true;
        cmd = DOpus.Create.Command ();
        cmd.SetSourceTab (closeListerData.lister.activetab);
        cmd.RunCommand ("Prefs LAYOUTSAVE=updatecurrent,single");
    }
}
1 Like