Next: Customizing through XML and Python files, Previous: The Key Manager Dialog, Up: Customizing and Extending GPS
GPS can be extensively customized through external plug-ins. You can write your own plug-ins (see Customization files and plugins), but GPS also comes with its own collection of plug-ins.
Some of them are loaded by default when GPS starts (for instance the support for the CVS version management system or support for highlighting in various programming languages); others are available for any user but not loaded automatically by GPS, for instance an Emacs emulation mode.
Among the plug-ins that are provided with GPS, you will find:
This emacs mode used to be activated in the preferences dialog, on the Themes page, but you should now activate it by loading the emacs.xml plug-in.
You can chose graphically which plug-ins should or should not be loaded
on startup. To do so, select the menu /Tools/Plug-ins
.
This brings up a new window, containing two parts:
As described in See Customization files and plugins, GPS will search for candidates in various directories, and based on these directories decide whether to automatically load the plug-in or not.
This list indicates the name of the plug-in, and whether it has been loaded in this GPS session (when the toggle button is checked).
This window is displayed as a notebook with two pages: on the first one you will see the exact location of the plug-in, the reason why it was loaded or not, and, more importantly, the source of the plug-in. By convention, each plug-in starts with a general comment that indicates the purpose of this plug-in, and some more detailed documentation on its usage.
For those interested, this also contains the plug-in itself, so that this can act as an example to create your own customization script.
The second page in the notebook can be used to edit the initialization commands. This commands will be executed after the module has been loaded (and never if the module is not loaded). This will typically be used to change some of the configuration variables for the plug-in (as documented in the plug-in itself).
Technically, the list of plug-in to load or not to load, and their initialization commands are stored in the file HOME/.gps/startup.xml. The list of initialization commands has the same format as used when creating GPS actions (see Defining Actions). The graphical editor in the Plug-Ins Editor makes it easier to edit the commands.
There are currently three kinds of commands that you can execute (you
can have any number of them, in any order you wish): GPS shell
commands, Python commands and external commands. External commands are
spawned outside of GPS, and can be used for instance to launch a
command such as ls
or gnatls -v
. In case the external
command returns an exit status different from 0, you can specify a
list of commands to execute (known as on-failure
commands).
To add any of the three kinds of commands, click on the appropriate
Add
button. This adds the commands just after the currently
selected one (or at the end if none is selected). If you have first
selected a on-failure
node, the new command will execute only
when the command to which on-failure is attached fails. If you want to
add another command to execute in case of failure, select that first
command, and click Add
again. If you then want to add a command
to execute when the first external command succeeded, select that
external command.
If you have modified anything through this dialog (the list of plug-ins to load or unload, or any of the initialization commands), you will need to restart GPS. GPS cannot unload a module, since it can have too many possible effects on GPS (adding menus, overriding key shortcuts, ...). Likewise, re-executing initialization commands immediately might be too late, since once they are running some of the scripts might not take the changes into account.
A dialog is displayed asking you whether you would like to exit GPS now. This will properly save all your files.