11.4. Editors and pagers
Some programs have the ability to launch an editor or pager program to edit or display a text document. Since there are lots of different editors and pagers available in the Debian distribution, the system administrator and each user should have the possibility to choose their preferred editor and pager.
In addition, every program should choose a good default editor/pager if none is selected by the user or system administrator.
Thus, every program that launches an editor or pager must use the EDITOR or PAGER environment variable to determine the editor or pager the user wishes to use. If these variables are not set, the programs /usr/bin/editor
and /usr/bin/pager
should be used, respectively. These commands may be invoked explicitly (e.g., as /usr/bin/editor
) or via a PATH search (e.g., as editor
).
These two files are managed through the dpkg
“alternatives” mechanism. Every package providing an editor or pager must call the update-alternatives
script to register as an alternative for /usr/bin/editor
or /usr/bin/pager
as appropriate. The alternative should have a slave alternative for /usr/share/man/man1/editor.1.gz
or /usr/share/man/man1/pager.1.gz
pointing to the corresponding manual page.
If it is very hard to adapt a program to make use of the EDITOR or PAGER variables, that program may be configured to use /usr/bin/sensible-editor
and /usr/bin/sensible-pager
as the editor or pager program respectively. These are two scripts provided in the sensible-utils package that check the EDITOR and PAGER variables and launch the appropriate program, and fall back to /usr/bin/editor
and /usr/bin/pager
if the variable is not set.
A program may also use the VISUAL environment variable to determine the user’s choice of editor. If it exists, it should take precedence over EDITOR. This is in fact what /usr/bin/sensible-editor
does.
It is not required for a package to depend on editor
and pager
, nor is it required for a package to provide such virtual packages. 2