Fix issues with loading autoloaded defcustoms while bound
* doc/lispref/customize.texi (Variable Definitions) (Variable Definitions): Update documentation. * lisp/custom.el (custom-initialize-set) (custom-initialize-reset): Update doc string. (custom-initialize-changed): Use set-default-toplevel-value. This fixes issues with (let ((custom-variable ...)) (autoload-function ...)). (custom-set-default): Ditto. * src/data.c (Fdefault_boundp): Update doc string.
This commit is contained in:
parent
07fb8d284f
commit
071722e411
3 changed files with 23 additions and 19 deletions
|
@ -376,7 +376,7 @@ name) and the new value, and should do whatever is necessary to update
|
|||
the value properly for this option (which may not mean simply setting
|
||||
the option as a Lisp variable); preferably, though, it should not
|
||||
modify its value argument destructively. The default for
|
||||
@var{setfunction} is @code{set-default}.
|
||||
@var{setfunction} is @code{set-default-toplevel-value}.
|
||||
|
||||
If you specify this keyword, the variable's documentation string
|
||||
should describe how to do the same job in hand-written Lisp code.
|
||||
|
@ -387,7 +387,7 @@ Specify @var{getfunction} as the way to extract the value of this
|
|||
option. The function @var{getfunction} should take one argument, a
|
||||
symbol, and should return whatever customize should use as the
|
||||
current value for that symbol (which need not be the symbol's Lisp
|
||||
value). The default is @code{default-value}.
|
||||
value). The default is @code{default-toplevel-value}.
|
||||
|
||||
You have to really understand the workings of Custom to use
|
||||
@code{:get} correctly. It is meant for values that are treated in
|
||||
|
@ -409,11 +409,11 @@ do not reinitialize it if it is already non-void.
|
|||
|
||||
@item custom-initialize-default
|
||||
Like @code{custom-initialize-set}, but use the function
|
||||
@code{set-default} to set the variable, instead of the variable's
|
||||
@code{:set} function. This is the usual choice for a variable whose
|
||||
@code{:set} function enables or disables a minor mode; with this choice,
|
||||
defining the variable will not call the minor mode function, but
|
||||
customizing the variable will do so.
|
||||
@code{set-default-toplevel-value} to set the variable, instead of the
|
||||
variable's @code{:set} function. This is the usual choice for a
|
||||
variable whose @code{:set} function enables or disables a minor mode;
|
||||
with this choice, defining the variable will not call the minor mode
|
||||
function, but customizing the variable will do so.
|
||||
|
||||
@item custom-initialize-reset
|
||||
Always use the @code{:set} function to initialize the variable. If
|
||||
|
@ -424,7 +424,7 @@ This is the default @code{:initialize} function.
|
|||
@item custom-initialize-changed
|
||||
Use the @code{:set} function to initialize the variable, if it is
|
||||
already set or has been customized; otherwise, just use
|
||||
@code{set-default}.
|
||||
@code{set-default-toplevel-value}.
|
||||
|
||||
@item custom-initialize-delay
|
||||
This function behaves like @code{custom-initialize-set}, but it
|
||||
|
|
|
@ -67,8 +67,10 @@ symbol."
|
|||
|
||||
(defun custom-initialize-set (symbol exp)
|
||||
"Initialize SYMBOL based on EXP.
|
||||
If the symbol doesn't have a default binding already,
|
||||
then set it using its `:set' function (or `set-default' if it has none).
|
||||
If the symbol doesn't have a default binding already, then set it
|
||||
using its `:set' function (or `set-default-toplevel-value' if it
|
||||
has none).
|
||||
|
||||
The value is either the value in the symbol's `saved-value' property,
|
||||
if any, or the value of EXP."
|
||||
(condition-case nil
|
||||
|
@ -81,7 +83,9 @@ if any, or the value of EXP."
|
|||
|
||||
(defun custom-initialize-reset (symbol exp)
|
||||
"Initialize SYMBOL based on EXP.
|
||||
Set the symbol, using its `:set' function (or `set-default' if it has none).
|
||||
Set the symbol, using its `:set' function (or `set-default-toplevel-value'
|
||||
if it has none).
|
||||
|
||||
The value is either the symbol's current value
|
||||
(as obtained using the `:get' function), if any,
|
||||
or the value in the symbol's `saved-value' property if any,
|
||||
|
@ -100,7 +104,7 @@ or (last of all) the value of EXP."
|
|||
"Initialize SYMBOL with EXP.
|
||||
Like `custom-initialize-reset', but only use the `:set' function if
|
||||
not using the standard setting.
|
||||
For the standard setting, use `set-default'."
|
||||
For the standard setting, use `set-default-toplevel-value'."
|
||||
(condition-case nil
|
||||
(let ((def (default-toplevel-value symbol)))
|
||||
(funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
|
||||
|
@ -114,7 +118,7 @@ For the standard setting, use `set-default'."
|
|||
symbol
|
||||
(eval (car (get symbol 'saved-value)))))
|
||||
(t
|
||||
(set-default symbol (eval exp)))))))
|
||||
(set-default-toplevel-value symbol (eval exp)))))))
|
||||
|
||||
(defvar custom-delayed-init-variables nil
|
||||
"List of variables whose initialization is pending until startup.
|
||||
|
@ -262,11 +266,11 @@ The following keywords are meaningful:
|
|||
when using the Customize user interface. It takes two arguments,
|
||||
the symbol to set and the value to give it. The function should
|
||||
not modify its value argument destructively. The default choice
|
||||
of function is `set-default'.
|
||||
of function is `set-default-toplevel-value'.
|
||||
:get VALUE should be a function to extract the value of symbol.
|
||||
The function takes one argument, a symbol, and should return
|
||||
the current value for that symbol. The default choice of function
|
||||
is `default-value'.
|
||||
is `default-toplevel-value'.
|
||||
:require
|
||||
VALUE should be a feature symbol. If you save a value
|
||||
for this option, then when your init file loads the value,
|
||||
|
@ -717,7 +721,7 @@ this sets the local binding in that buffer instead."
|
|||
(if custom-local-buffer
|
||||
(with-current-buffer custom-local-buffer
|
||||
(set variable value))
|
||||
(set-default variable value)))
|
||||
(set-default-toplevel-value variable value)))
|
||||
|
||||
(defun custom-set-minor-mode (variable value)
|
||||
":set function for minor mode variables.
|
||||
|
|
|
@ -1939,9 +1939,9 @@ default_value (Lisp_Object symbol)
|
|||
|
||||
DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0,
|
||||
doc: /* Return t if SYMBOL has a non-void default value.
|
||||
A variable may have a buffer-local or a `let'-bound local value. This
|
||||
function says whether the variable has a non-void value outside of the
|
||||
current context. Also see `default-value'. */)
|
||||
A variable may have a buffer-local value. This function says whether
|
||||
the variable has a non-void value outside of the current buffer
|
||||
context. Also see `default-value'. */)
|
||||
(Lisp_Object symbol)
|
||||
{
|
||||
register Lisp_Object value;
|
||||
|
|
Loading…
Add table
Reference in a new issue