all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Glenn Morris <rgm@gnu.org>, 10773@debbugs.gnu.org
Subject: bug#10773: set-variable can't change values of user options
Date: Sat, 19 Sep 2020 17:21:53 +0200	[thread overview]
Message-ID: <878sd5pzam.fsf@gnus.org> (raw)
In-Reply-To: <jwvmx8ofz6m.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 11 Feb 2012 23:34:15 -0500")

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





  parent reply	other threads:[~2020-09-19 15:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  9:43 bug#10773: set-variable can't change values of user options Juri Linkov
2012-02-09 18:28 ` Glenn Morris
2012-02-10  8:18   ` Kevin Rodgers
2012-02-10 10:18   ` Juri Linkov
2012-02-10 17:31     ` Glenn Morris
2012-02-10 18:01       ` Glenn Morris
2012-02-12  4:34         ` Stefan Monnier
2012-02-12 20:16           ` Glenn Morris
2012-02-13  2:58             ` Stefan Monnier
2020-09-19 15:21           ` Lars Ingebrigtsen [this message]
2020-09-19 15:46             ` Stefan Monnier
2020-09-19 15:49               ` Lars Ingebrigtsen
2020-09-19 16:04                 ` Stefan Monnier
2020-09-20  9:14                   ` Lars Ingebrigtsen
2012-02-21  0:40 ` Juri Linkov
2012-02-21 15:26   ` Drew Adams
2012-02-22  0:16     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878sd5pzam.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=10773@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.