Skip to content

Commit

Permalink
Make SetUserPreferences obsolete
Browse files Browse the repository at this point in the history
It should be removed in 4.9
  • Loading branch information
markuspf committed Jan 21, 2016
1 parent b1b97b4 commit d72899f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 47 deletions.
47 changes: 0 additions & 47 deletions lib/init.g
Original file line number Diff line number Diff line change
Expand Up @@ -756,51 +756,6 @@ TypeObj(IMPLICATIONS[1]);
#T and what about implications installed in packages?
#T (put later installations to the front?)


#############################################################################
##
## Set the defaults of `GAPInfo.UserPreferences'.
##
## We locate the first file `gap.ini' in GAP root directories,
## and read it if available.
## This must be done before `GAPInfo.UserPreferences' is used.
## Some of the preferences require an initialization,
## but this cannot be called before the complete library has been loaded.
##

# The following function is not recommended anymore.
# Give a warning but do what the function was expected to do.
BindGlobal( "SetUserPreferences", function( arg )
local name, record;

Info( InfoWarning, 1, "");
Info( InfoWarning, 1, Concatenation( [
"The call to 'SetUserPreferences' (probably in a 'gap.ini' file)\n",
"#I should be replaced by individual 'SetUserPreference' calls,\n",
"#I which are package specific.\n",
"#I Try 'WriteGapIniFile()'." ] ) );

# Set the new values.
if Length( arg ) = 1 then
record:= arg[1];
if not IsBound(GAPInfo.UserPreferences.gapdoc) then
GAPInfo.UserPreferences.gapdoc := rec();
fi;
if not IsBound(GAPInfo.UserPreferences.gap) then
GAPInfo.UserPreferences.gap := rec();
fi;
for name in RecNames( record ) do
if name in [ "HTMLStyle", "TextTheme", "UseMathJax" ] then
GAPInfo.UserPreferences.gapdoc.( name ):= record.( name );
else
GAPInfo.UserPreferences.gap.( name ):= record.( name );
fi;
od;
fi;
end );

# SetUserPreferences();

# Here are a few general user preferences which may be useful for
# various purposes. They are self-explaining.
DeclareUserPreference( rec(
Expand All @@ -827,7 +782,6 @@ CallAndInstallPostRestore( function()
READ_GAP_ROOT( "gap.ini" );
end );


#############################################################################
##
#X files installing compatibility with deprecated, obsolescent or
Expand Down Expand Up @@ -857,7 +811,6 @@ CallAndInstallPostRestore( function()
fi;
end );


#############################################################################
##
## ParGAP/MPI slave hook
Expand Down
41 changes: 41 additions & 0 deletions lib/obsolete.gi
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,47 @@ InstallGlobalFunction( USER_HOME_EXPAND, function(str)
return UserHomeExpand(str);
end);

#############################################################################
##
#F SetUserPreferences
##
## Set the defaults of `GAPInfo.UserPreferences'.
##
## We locate the first file `gap.ini' in GAP root directories,
## and read it if available.
## This must be done before `GAPInfo.UserPreferences' is used.
## Some of the preferences require an initialization,
## but this cannot be called before the complete library has been loaded.
##
BindGlobal( "SetUserPreferences", function( arg )
local name, record;

Info( InfoWarning, 1, "");
Info( InfoWarning, 1, Concatenation( [
"The call to 'SetUserPreferences' (probably in a 'gap.ini' file)\n",
"#I should be replaced by individual 'SetUserPreference' calls,\n",
"#I which are package specific.\n",
"#I Try 'WriteGapIniFile()'." ] ) );

# Set the new values.
if Length( arg ) = 1 then
record:= arg[1];
if not IsBound(GAPInfo.UserPreferences.gapdoc) then
GAPInfo.UserPreferences.gapdoc := rec();
fi;
if not IsBound(GAPInfo.UserPreferences.gap) then
GAPInfo.UserPreferences.gap := rec();
fi;
for name in RecNames( record ) do
if name in [ "HTMLStyle", "TextTheme", "UseMathJax" ] then
GAPInfo.UserPreferences.gapdoc.( name ):= record.( name );
else
GAPInfo.UserPreferences.gap.( name ):= record.( name );
fi;
od;
fi;
end );

#############################################################################
##
#E
Expand Down

0 comments on commit d72899f

Please sign in to comment.