A hook can be made of any number of components. Broadly, the three component-types of hooks used by Cokeror are global, simple-local, and local.
- Global hooks
- Global hooks have only one component, a hook in application context.
- Simple-local hooks
Simple-local hooks have two components: a local component for the specific object in question and a global hook which will be run for any object. For example, the window_* hooks are all simple-local. You can add a hook function to the global component, which will be run when the given event happens in any window, or you can add a hook function to the local component of a specific window so your function will only get run when the given event happens in that window.
- Local hooks
Local hooks have more components than simple-local (limited by current implementation to three). These components represent the levels of a hierarchy. For instance, the buffer_* hooks are local hooks with three components: you can put a hook function on the component local to a specific buffer, so that the function will run for the event only in that buffer; you can put a hook function on the component of a specific window, so that it will run when the event happens in any buffer in that window; or you can put a hook function on the global component, meaning it will run when the event happens in any buffer.