Hooks are variables which contain Lisp functions (or lists of functions)
which are called at various times. Calc defines a number of hooks
that help you to customize it in various ways. Calc uses the Lisp
run-hooks to invoke the hooks shown below. Several
other customization-related variables are also described here.
This hook is called at the end of calc.el, after the file has been loaded, before any functions in it have been called, but after
calc-mode-mapand similar variables have been set up.
This hook is called as the last step in a M-x calc command. At this point, the Calc buffer has been created and initialized if necessary, the Calc window and trail window have been created, and the “Welcome to Calc” message has been displayed.
This hook is called when the Calc buffer is being created. Usually this will only happen once per Emacs session. The hook is called after Emacs has switched to the new buffer, the mode-settings file has been read if necessary, and all other buffer-local variables have been set up. After this hook returns, Calc will perform a
calc-refreshoperation, set up the mode line display, then evaluate any deferred
calc-defineproperties that have not been evaluated yet.
This hook is called when the Calc Trail buffer is being created. It is called as the very last step of setting up the Trail buffer. Like
calc-mode-hook, this will normally happen only once per Emacs session.
This hook is called by
calc-quit, generally because the user presses q or C-x * c while in Calc. The Calc buffer will be the current buffer. The hook is called as the very first step, before the Calc window is destroyed.
If this hook is non-
nil, it is called to create the Calc window. Upon return, this new Calc window should be the current window. (The Calc buffer will already be the current buffer when the hook is called.) If the hook is not defined, Calc will generally use
select-windowto create the Calc window.
If this hook is non-
nil, it is called to create the Calc Trail window. The variable
calc-trail-bufferwill contain the buffer which the window should use. Unlike
calc-window-hook, this hook must not switch into the new window.
This hook is called the first time that Embedded mode is entered.
This hook is called each time that Embedded mode is entered in a new buffer.
This hook is called each time that Embedded mode is enabled for a new formula.
This hook is called by
calc-edit(and the other “edit” commands) when the temporary editing buffer is being created. The buffer will have been selected and set up to be in
calc-edit-mode, but will not yet have been filled with text. (In fact it may still have leftover text from a previous
This hook is called by the
calc-save-modescommand, after Calc's own mode features have been inserted into the Calc init file and just before the “End of mode settings” message is inserted.
This hook is called after C-x * 0 (
calc-reset) has reset all modes. The Calc buffer will be the current buffer.
This variable contains a list of strings. The strings are concatenated at the end of the modes portion of the Calc mode line (after standard modes such as “Deg”, “Inv” and “Hyp”). Each string should be a short, single word followed by a space. The variable is
This is the keymap that is used by Calc mode. The best time to adjust it is probably in a
calc-mode-hook. If the Calc extensions package (calc-ext.el) has not yet been loaded, many of these keys will be bound to
calc-missing-key, which is a command that loads the extensions package and “retypes” the key. If your
calc-mode-hookrebinds one of these keys, it will probably be overridden when the extensions are loaded.
This is the keymap that is used during numeric entry. Numeric entry uses the minibuffer, but this map binds every non-numeric key to
calcDigit-nondigitwhich generally calls
exit-minibufferand “retypes” the key.
This is the keymap that is used during algebraic entry. This is mostly a copy of
This is the keymap that is used during entry of variable names for commands like
calc-recall. This is mostly a copy of
This is the (sparse) keymap used by
calc-editand other temporary editing commands. It binds <RET>, <LFD>, and C-c C-c to
This is a list of variables which are saved by
calc-save-modes. Each entry is a list of two items, the variable (as a Lisp symbol) and its default value. When modes are being saved, each variable is compared with its default value (using
equal) and any non-default variables are written out.
This is a list of variables which should be buffer-local to the Calc buffer. Each entry is a variable name (as a Lisp symbol). These variables also have their default values manipulated by the
calc-quitcommands; see Multiple Calculators. Since
calc-mode-hookis called after this list has been used the first time, your hook should add a variable to the list and also call