[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6578: 24.0.50; defcustom :set does not apply to `set-variable'
From: |
Drew Adams |
Subject: |
bug#6578: 24.0.50; defcustom :set does not apply to `set-variable' |
Date: |
Wed, 21 Aug 2019 16:39:12 -0700 (PDT) |
> > If you use a :set entry for defcustom, it is not
> > respected by `set-variable'. It should be. When
> > a user uses `M-x set-variable' s?he should get the
> > effect of :set. Otherwise, the defcustom is not
> > serving its purpose. defcustom is not only for
> > Customize - it needs to work with `set-variable'
> > also. And it does, for :type; but it does not,
> > for :set.
>
> This is apparently by design:
>
> ----
> Note that this function is at heart equivalent to the basic ‘set’
> function.
> For a variable defined with ‘defcustom’, it does not pay attention to
> any :set property that the variable might have (if you want that, use
> M-x customize-set-variable instead).
> ----
I know (and knew) that the behavior is documented.
That doesn't mean it's good. This is an enhancement
request: it "_should_" provide the effect of :set.
Anything else is just a gotcha, inviting problems.
We document the weak behavior, because it is what it
is. We should document it, whatever it is. That
doesn't make it good.
What's more, `customize-set-variable' isn't even
documented in the Emacs or Elisp manuals.
`set-variable' is (in the Emacs manual), and it even
has an index entry. What's more, (emacs) `Examining'
says that "The most convenient way to set a specific
customizable variable is with `set-variable'.
That's an endorsement/recommendation, and it can get
users into trouble.
That doc should perhaps use `customize-set-variable'
instead. More generally, perhaps some harmonizing
of behavior/features is in order, among `set-variable',
`customize-set-variable', and `customize-set-value'.
Users can be excused for being confused, and they
can get into trouble when they set an option value
using just `set-variable' or `setq', if it has a
:set function.
Emacs should be enhanced to clear up the confusing
differences and clear up the doc recommendations.
> So I'm closing this bug report.
Unfortunate. Someone might have implemented the
enhancement someday.