Subject: Re: bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable'? Really?

From: Eli Zaretskii <[email-masked]>
Date: Sun, 12 Sep 2021 13:11:52 +0300

> Date: Sun, 12 Sep 2021 09:54:51 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked], [email-masked], [email-masked]
> 
> >>> Also, warnings.el is not preloaded, so this call could barf in some 
> >>> valid cases.
> >>
> >> That's not what I see:
> >>
> >> ;;;###autoload
> >> (defun display-warning (type message &optional level buffer-name)
> >
> > That's autoloaded, not preloaded; the latter is in loadup.el.
> >
> 
> Hmm, then I don't see what you mean.  I did not know that there is a 
> difference between "autoload" and "preload".

The difference is that while Emacs is being built, especially
bootstrapped, calls to Lisp code that isn't preloaded by autoload.el
could fail.  So such calls need to be careful not to call a symbol if
the call could fail, or at least use internal_condition_case*
functions to protect themselves against failure.

> > Is this multiplicative, i.e. if you perform it many times, does it 
> > indeed take 20% longer overall?  If so, this is not an acceptable 
> > performance hit, I think, not for such a minor feature.
> >
> 
> The "(get sym 'custom-set)" call adds about ~8 nanoseconds to each call to 
> setq.  I don't see how this could be avoided, if the idea is to display a 
> warning when setq is used when customize-set-variable should be used 
> instead.  Of course every new feature comes at a cost.
> 
> Perhaps a new defcustom could be created, e.g. customize-warn-setq, 
> defaulting to t, to make it possible to avoid that call to "(get sym 
> 'custom-set)"?

Are we only doing this only for initializations in the init files?
Then perhaps this could be enabled only until the startup is
completed.  Even then, some people will frown on 20% slowdown of the
startup.

Let's see what others think about this aspect.