Subject: bug#10773: set-variable can't change values of user options

From: Stefan Monnier <[email-masked]>
Date: Sat, 19 Sep 2020 11:46:04 -0400

> There's still the question of using allowing these variables to be
> customized, and that still doesn't work:
>
> (customize-variable 'flyspell-mode-hook)
> -> "NO CUSTOMIZATION DATA; not intended to be customized."
>
> But...  why not?

I don't have a strong opinion either way.

>  So I've now added the patch below to Emacs 28.
>
> diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
> index e3eb9294ed..fdc1233540 100644
> --- a/lisp/emacs-lisp/easy-mmode.el
> +++ b/lisp/emacs-lisp/easy-mmode.el
> @@ -335,6 +335,9 @@ define-minor-mode
>  No problems result if this variable is not bound.
>  `add-hook' automatically binds it.  (This is true for all hook variables.)"
>                         modefun)))
> +       ;; Allow using using `M-x customize-variable' on the hook.
> +       (put ',hook 'custom-type 'hook)
> +       (put ',hook 'standard-value (list nil))
>  
>         ;; Define the minor-mode keymap.
>         ,(unless (symbolp keymap)	;nil is also a symbol.

Shouldn't we be using `defcustom` instead of hard-coding Custom's
"internal" properties?

        Stefan