Page modes, in the spirit of Emacs major modes and GreaseMonkey scripts, allow site-specific functionality to be implemented in Conkeror.
2. Loading, Activating, Deactivating
When we talk about page modes, there are three terms that we would do well not to confuse: loading, activating, and enabling.
Loading a page-mode means evaluating the module that contains a page-mode, usually by calling require on its file.
Activating a page-mode means calling page_mode_activate on a loaded page-mode, thus causing it to auto-enable when we visit a covered site. The opposite of activating is deactivating, which is calling page_mode_deactivate on a loaded page-mode to prevent it from auto-enabling.
- Enabling a page-mode is when you turn a page-mode on, to have an effect on the current buffer. Activated page-modes are enabled automatically when a covered page is visited.
Some page-modes are loaded by default, and some page-modes, when loaded, are auto-activated. To deactivate a loaded page-mode, call page_mode_deactivate on it, like this:
To activate a loaded page-mode, call page_mode_activate on it, like this:
To load a non-default page-mode, call require on its module name, like this:
To find out how to prevent a default page-mode from being loaded, see Modules.
3. Changing Coverage
It is not only possible, but easy, to change the coverage of a page-mode, for instance, to add a site to have it auto-enable for. The 'test' property of a page-mode is an array that can be pushed and popped to customize the coverage of the page-mode.
some_mode.test.push(build_url_regexp($domain = "example"));
4. Note About Key Bindings
Some page modes bind keys that override important Conkeror bindings like f and g. When such a page mode is in effect, you can still access shadowed bindings by using the prefix key C-z. For example, to call the follow command when gmail-mode is in effect, press C-z f.