Contents
A buffer-mode is a type of mode that can be enabled and disabled per-buffer, and whose effects are confined to an individual buffer. Some buffer-modes' function is to install a temporary keymap, like quote-mode and quote-next-mode. Other buffer-modes do more, like caret-mode.
1. define_buffer_mode
The call form of define_buffer_mode looks like this:
define_buffer_mode("example-mode", function enable (buffer) { }, function disable (buffer) { }, $doc = "An example buffer-mode.");
Assuming the name "example-mode", define_buffer_mode produces the following things:
A variable example_mode whose value is an object containing all of the properties of the mode, including enable and disable methods.
A command example-mode that toggles the mode for the current buffer.
Two hooks, example_mode_enable_hook and example_mode_disable_hook.