[INTERNAL] The Order of Precedence in IDL Preference Settings
Anonym
This Help Article presents the hierarchy of precedence for IDL preferences and discusses the consequences it can have for IDL users. This article is written based on an IDL 6.x version.
IDL preference values can come from a variety of sources and there is a hierarchy of these sources. IDL will use the value from the source of the highest precedence. Only one source will rule any given IDL session.
The IDL preference sources are listed below from the lowest precedence to highest. The consequences for users are discussed for each source.
Source 1: IDL Preference Default Value
The preference default values are used if no other sources are defined. Default values can be checked using the following IDL command:
HELP, /PREFERENCES, /FULL
Example: Output for the IDL_GR_WIN_RENDERER preference:
** IDL_GR_WIN_RENDERER LONG(GR_RENDERER)
Purpose: Default method used for volume rendering.
Category: Graphics (Microsoft Windows).
Committed Changes Take Effect: Immediately.
Allowed Values:
0 (Hardware)
1 (Software)
Effective Value(UserPrefFile): Software(1)
Default: Hardware(0)
The default value for the IDL_GR_WIN_RENDERER preference is the Hardware definition (0 value). In this example the effective value used by IDK is not the default one. It is the value defined in the User Preference File.
Source 2: IDL User Preference File
The IDL User Preference File is called idl.pref. The path to this file is returned by the following IDL command:
Output example:
Distribution File: C:\RSI\IDL63\resource\pref\idl.pref
User File: C:\Documents and Settings\bcasson\.idl\rsi\pref-10-idl_6_3-windows\idl.pref
# Changes Pending: 0
In this example the IDL user Preference File is located in the C:\Documents and Settings\bcasson\.idl\rsi\pref-10-idl_6_3-windows\ directory.
This command also returns the directory in which the Distribution Preference File is stored: C:\RSI\IDL63\resource\pref\idl.pref.
The IDL User Preference File can be modified:
a. Using the IDL Preference Interface:

This interface can be launched from the idlde menu: File -> preferences
b. Using a text editor:

c. From the IDL prompt: using the PREF_SET or PREF_COMMIT routines:
PREF_SET,'IDL_GR_WIN_RENDERER',1
A preference value defined from the User Preference File will govern
- one specific version of IDL
- one specific user login
The other IDL versions installed on the same machine and the other IDL users will each be using their own User Preference Files.
Source 3: IDL Distribution Preference File
The IDL Distribution Preference File is called idl.pref and is located in the [IDL_DIR]/resource/pref/ directory where IDL_DIR is the IDL installation directory. For example on Windows for IDL 6.3 this directory is C:\RSI\IDL63\resource\pref\.
This file can be modified using a text editor. It uses the same syntax as the IDL User Preference File.

A preference value defined from the Distribution Preference File will be available
- for a specific version of IDL: thoe other IDL versions installed on the same machine could have a different Distribution Preference File
- for all the user sessions defined on the machine.
It is recommended to use this source when a preference value needs to be established for all IDL users. This preference value is read only so it cannot be modified by the PREF_SET or PREF_COMMIT routines or through the graphic interface (which will not be editable anymore).

The only way to modify a preference defined in the Distribution Preference File is then to use a source of a higher priority or to edit/modify the Distribution Preference File. Such modification will take effect after restarting IDL.
Source 4: System Environment Variables
IDL preferences may be defined in so-called shell environment variables. They may be defined for the machine (so-called System variables) or for the individual user. These preference settings take precedence over all three of the above sources.
On UNIX, Linux or MAC OS X these variables should be defined in the shell-configuration files (.cshrc, .tcshrc, .profile or .bashrc files).
Example demonstrating the IDL_GR_X_RENDERER preference:
- C or TC shell syntax: setenv IDL_GR_X_RENDERER 1
- bash or Korn shell syntax: export IDL_GR_X_RENDERER=1
On Windows the Environment Variables dialog window can be used
- Open the Control Panel
- Select System -> Advanced -> Environment Variables
- In the System Variables list, select 'New' to define a new environment variable.

A preference value defined from a System Environment Variable will be available:
- for all IDL versions running on the system
- for all the user sessions
This preference value is read only so it cannot be modified by the PREF_SET or PREF_COMMIT routines or through the graphic interface (which will not be editable anymore)
The only way to modify a preference defined by an environment variable is then to use a source of a higher priority or to change it at the source in the UNIX shell-configuration files or from the Windows system dialog window. Such modification will take effect after restarting IDL.
Source 5: Command Line
The source of the highest precedence consists of defining the preference values in flag arguments to the system/shell commands "idl" or "idlde". This can be done in 2 different ways:
Case 1: Specifying the preference value at a command line when starting IDL For example:
Case 2: specifying the preference value using a -pref flag when starting IDL. In that case the argument to -pref is the path to a text file of preference assignments that will be called and read when 'idl' or 'idlde' starts.
- Create a file called test.pref in which a preference value is defined

- Start IDL using the command
idl -pref=/usr/temp/test.pref
On windows the target of the IDL icon can be modified to point to this file:
C:\RSI\ID63\bin\bin.x86\idlde.exe -pref=C:\temp\test.pref
Note that the preference defined directly at the command line (case 1) takes precedence over those specified within a command line preference file (case 2).