Subject: Re: bug#53178: ert should use existing explainers for aliases

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 13 Jan 2022 09:48:56 +0100

Stefan Kangas <[email-masked]> writes:

> There exists an ert explainer for `string-equal', but it is not used if
> `string=' (an alias for `string-equal') is used in the test.
>
> This should be fixed such that an existing explainer is always used for
> an alias.

I started implementing this, but then I ran into the problem of possible
defalias loops.  I thought we had a function somewhere that would just
return the defalias chain, but I can't find it anywhere.  And indeed:

(defalias 'a 'b)
(defalias 'b 'a)

And then `C-h f a RET' will infloop because

(defun help-fns--analyze-function (function)
[...]
                    ((and aliased (not (subrp def)))
                     (let ((f real-function))
                       (while (and (fboundp f)
                                   (symbolp (symbol-function f)))
                         (setq f (symbol-function f)))
                       f))

So I've now added a new function for this, fixed the infloop in
help-fns, and fixed the explainer lookup in ert.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no