Previous IDL Reference Guide: Procedures and Functions Next

PREF_SET

The PREF_SET procedure is used to set new values for IDL preferences. Once committed, these values are written to the user's IDL preference file and persist between IDL sessions. For more information on committing preference values, see the discussion of the COMMIT keyword below, as well as the documentation for PREF_COMMIT.


Note
A preference is considered to be read-only if its value is currently being set by a source with a higher precedence than that of the user's preference file (command line, environment variable, or IDL distribution preference file). You cannot use PREF_SET to change the value of such a preference. You must instead change the preference's value at its source and then restart IDL.


Note
Authors of IDL applications should not use this routine in their code to make preference changes. See Using Preference Etiquette for more information.

Syntax

PREF_SET, PrefName1, Value1 [, ... PrefNamen, Valuen ] [, /COMMIT]

or

PREF_SET, PrefName1 [, ... PrefNamen ] , /DEFAULT, [, /COMMIT]

or

PREF_SET, FILENAME=file [, /COMMIT]

The first syntax uses a preference-value pair to set the value for each preference named. The second syntax uses the default value for each preference named. The third syntax imports values from the named preference file.

Arguments

PrefNamesi

A string containing the name of the preference being set.

Valuei

The value of the preference being set.

Keywords

COMMIT

Set this keyword to immediately commit all of the preferences made by this call. Normally, PREF_SET puts new preference values into a pending state in which IDL remembers the change, but does not use it. In order to make a pending preference value take effect, it must first be committed. Alternatively, you can use the PREF_COMMIT procedure after this call.

DEFAULT

If this keyword is set, each specified preference is set to IDL's default value for it. You can see the default value for each preference by issuing the following command:

HELP, /PREFERENCES, /FULL  

 


Note
If DEFAULT is set, you must use the PrefName argument to specify a preference (or more than one preference with PrefName1 ... PrefNamen).

FILENAME

Set this keyword to supply the path to an existing IDL preference file. PREF_SET reads the file and sets all preferences referenced within to the specified values. FILENAME is used to migrate preferences from other IDL versions. It is, for example, the method by which the PREF_MIGRATE procedure works.


Note
If FILENAME is set, you cannot use the PrefName and Value arguments.

Examples

Under UNIX, issue the following command to set the default value of the !PATH system variable to use a locally installed library of IDL programs in /usr/local/idllib, followed by the default IDL libraries, and to immediately commit the change:

PREF_SET, 'IDL_PATH', '+/usr/local/idllib:<IDL_DEFAULT>', /COMMIT  

Under Microsoft Windows, issue the following commands to set the default value of the !PATH system variable to use a locally installed library of IDL programs in C:\local_idllib, followed by the default IDL libraries, but defer the commit step to a later call to IDL_COMMIT:

PREF_SET, 'IDL_PATH', '+C:\local_idllib;<IDL_DEFAULT>'  
...  
PREF_COMMIT  

To revert to using IDL's default for the initial value of !PATH:

PREF_SET, 'IDL_PATH', /DEFAULT  

Version History

6.2
Introduced

See Also

PREF_COMMIT, PREF_GET, PREF_MIGRATE

  IDL Online Help (March 06, 2007)