* Re: master 6d8638e5e4: Give a warning if setopt has been used with an invalid value
[not found] ` <20220705173330.12D0BC01684@vcs2.savannah.gnu.org>
@ 2022-07-05 20:30 ` Stefan Monnier
2022-07-05 20:43 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2022-07-05 20:30 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
Lars Ingebrigtsen [2022-07-05 13:33:29] wrote:
> diff --git a/lisp/custom.el b/lisp/custom.el
> index 2b7621229d..a6e2ab351d 100644
> --- a/lisp/custom.el
> +++ b/lisp/custom.el
> @@ -90,6 +90,16 @@ 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,
> or (last of all) the value of EXP."
> + ;; If this value has been set with `setopt' (for instance in
> + ;; ~/.emacs), we didn't necessarily know the type of the user option
> + ;; then. So check now, and issue a warning if it's wrong.
> + (when-let ((value (get symbol 'custom-check-value))
> + (type (get symbol 'custom-type)))
> + (when (and (boundp symbol)
> + (eq (car value) (symbol-value symbol))
> + ;; Check that the type is correct.
> + (not (widget-apply (widget-convert type) :match (car value))))
> + (warn "Value `%S' for `%s' does not match type %s" value symbol type)))
> (funcall (or (get symbol 'custom-set) #'set-default-toplevel-value)
> symbol
> (condition-case nil
This breaks bootstrap for me because `when-let` in `subr.el` uses
`macroexp-progn` which is not yet defined when `custom.el` is loaded.
Maybe `macroexp.el` should be loaded earlier in `loadup.el` (it is after
all a file that provides some of the core infrastructure for ELisp's own
execution, whereas `custom.el` is dedicated to higher-level
functionality). But according to a comment I put in `loadup.el` there
might be some issues to deal with if we want to do that.
Personally I just don't find `when-let` to be worth the trouble.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: master 6d8638e5e4: Give a warning if setopt has been used with an invalid value
2022-07-05 20:30 ` master 6d8638e5e4: Give a warning if setopt has been used with an invalid value Stefan Monnier
@ 2022-07-05 20:43 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 20:43 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> This breaks bootstrap for me because `when-let` in `subr.el` uses
> `macroexp-progn` which is not yet defined when `custom.el` is loaded.
Darn; I keep forgetting that custom.el is used so early in the boot
process.
I've now open-coded when-let in that snippet.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-05 20:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <165704240974.3486.6742610751803719234@vcs2.savannah.gnu.org>
[not found] ` <20220705173330.12D0BC01684@vcs2.savannah.gnu.org>
2022-07-05 20:30 ` master 6d8638e5e4: Give a warning if setopt has been used with an invalid value Stefan Monnier
2022-07-05 20:43 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).