[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10773: set-variable can't change values of user options
From: |
Lars Ingebrigtsen |
Subject: |
bug#10773: set-variable can't change values of user options |
Date: |
Sat, 19 Sep 2020 17:21:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>> But I think that has been previously rejected.
>
> That was a long time ago. We should do it for 24.2.
Reintroducing defvars for define-minor-mode hook variables was done the
following year:
commit 7f17cc40ef9120ba1b1715399432f26e8850505a
Author: Stefan Monnier <monnier@iro.umontreal.ca>
AuthorDate: Mon May 27 12:12:52 2013 -0400
Always defvar a mode's hook and provide a docstring.
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
* lisp/emacs-lisp/derived.el (define-derived-mode): Always defvar the
mode hook and provide a docstring.
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? 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.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#10773: set-variable can't change values of user options,
Lars Ingebrigtsen <=