$buffer-fhook(5)$buffer-fhook - Buffer macro hook command name (buffer creation)
$buffer-dhook - Buffer macro hook command name (buffer deletion)
$buffer-bhook - Buffer macro hook command name (buffer current)
$buffer-ehook - Buffer macro hook command name (buffer swapped)
$buffer-fhook FunctionName
$buffer-dhook FunctionName
$buffer-bhook FunctionName
$buffer-ehook FunctionName
Defines the buffer create, delete, begin and end hook command which are executed:
$buffer-fhook
$buffer-dhook
$buffer-bhook
$buffer-ehook
The variable $buffer-fhook cannot be directly set and is largely redundant as the file hook is executed only when the buffer's major-mode(2) is first assigned. Its main use is within macros which wish to ascertain what type of buffer it is executing on, i.e. if a command was to be executed only on C files then the follow ensures that this is the case:
!iif ¬ &seq $buffer-fhook "fhook-c" !abort
Where the command fhook-c is the C major-mode file hook, note that the $buffer-major-mode(5) can often be used for the same purposes.
dhooks are executed when a buffer is deleted, but before the contents of the buffer are lost. Note that dhooks will not be called if the buffer never becomes active, or if MicroEmacs quits due to the receipt of a panic signal.
bhooks and ehooks are usually used to set and restore global variables which require different setting in the current buffer.
These variables are initially set by the system when the buffer first becomes active, when the buffer's major-mode(2) is determined. After this point the dhook, bhook & ehook variables can be set to any function the user wishes, however the $buffer-fhook variable can only be changed by calls to major-mode as the value of the variable must stay in sync with $buffer-major-mode(5).
(c) Copyright JASSPA 2026
Last Modified: 2026/01/18
Generated On: 2026/01/31