Skip to content

Commit

Permalink
Merge pull request #512 from markuspf/obsolete-setuserpreference
Browse files Browse the repository at this point in the history
Make SetUserPreferences obsolete
  • Loading branch information
alex-konovalov committed Jan 28, 2016
2 parents 1e775e2 + b3034a0 commit 54cc947
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 45 deletions.
45 changes: 0 additions & 45 deletions lib/init.g
Original file line number Diff line number Diff line change
Expand Up @@ -679,49 +679,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 );

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


#############################################################################
##
#X files installing compatibility with deprecated, obsolescent or
Expand Down Expand Up @@ -778,7 +734,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( InfoObsolete, 1, "");
Info( InfoObsolete, 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 54cc947

Please sign in to comment.