Subject: Re: bug#74511: 31.0.50; `dictionary-search-interface' overrides the user's customization of `dictionary-read-word-function'

From: Eli Zaretskii <[email-masked]>
Date: Tue, 26 Nov 2024 14:59:11 +0200

> From: Eshel Yaron <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Mon, 25 Nov 2024 22:27:57 +0100
> 
> Steven Allen <[email-masked]> writes:
> 
> > Eshel Yaron <[email-masked]> writes:
> >
> >>
> >> The patch below tries to do both: 
> >>
> >> - it adds a few words to the docstring of dictionary-search-interface
> >>   which explain that this option can only be meaningfully set after
> >>   loading dictionary.el, and
> >> - it avoids clobbering existing settings for the other options during
> >>   initialization.  It still overrides existing settings for the other
> >>   options if you set dictionary-search-interface after dictionary.el,
> >>   because that's the intended behavior when customizing this option.
> >>
> >> WDYT?
> >>
> >
> > Is adding the following to `dictionary-search-interface' not sufficient?
> >
> >     :initialize 'custom-initialize-changed
> >
> > That would apply the `dictionary-search-interface' setting if and only
> > if specified by the user while still alowing the user to, e.g., use the
> > customize interface.
> 
> Ah yes, seems even better than my patch since it also makes it possible
> to set dictionary-search-interface before loading dictionary.el, thanks!
> 
> Eli, does this seem OK for the release branch?
> 
> diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
> index 58c2e9771ba..42fb8c57b40 100644
> --- a/lisp/net/dictionary.el
> +++ b/lisp/net/dictionary.el
> @@ -317,6 +317,7 @@ dictionary-search-interface
>                        dictionary-read-dictionary-function)
>                       vals))
>           (set-default-toplevel-value symbol value))
> +  :initialize #'custom-initialize-changed
>    :version "30.1")

Don't you mean custom-initialize-set?

If I'm missing something, please describe what will happen in the
various scenarios when dictionary-search-interface and the other
related options are customized, whether by setq or via Custom, and
when they are not customized the first time dictionary.el is loaded.
When we understand all the effects of this, we can reason whether the
change is safe for the emacs-30 branch (which it better be, since
these options were introduced in Emacs 30, AFAIR).

Thanks.