Subject: bug#62762: circular dependencies in elisp files and make

From: Max Nikulin <[email-masked]>
Date: Thu, 11 May 2023 22:14:03 +0700

On 06/05/2023 01:26, Stefan Monnier wrote:
>> If you want to find them, you will have to write the code to detect
>> those dependencies, and then look at the graph produced from them.
>> There's no other way (unless Stefan happens to remember some by
>> heart, by some luck).
> I think looking for calls to `provide` that are not at the end of files
> is a good first step to finding the obvious ones (if my memory serves,
> viper and ediff are two examples in Emacs's own code.

I see no cyclic dependency in viper, at least based on `require':

viper.elc: viper-init.elc viper-keym.elc viper-cmd.elc
viper-cmd.elc: viper-util.elc viper-keym.elc viper-mous.elc 
viper-macs.elc viper-ex.elc
viper-macs.elc: viper-mous.elc viper-ex.elc viper-util.elc viper-keym.elc
viper-ex.elc: viper-keym.elc viper-util.elc
viper-keym.elc: viper-util.elc
viper-mous.elc: viper-util.elc
viper-util.elc: viper-init.elc

I expect that it should ensure ordering for make allowing parallel 
execution to some degree.

Frankly speaking, I have not realized why `provide' not at the end is 
important. Do you mean the following

lisp/vc/ediff-util.el:(provide 'ediff-util)    ;FIXME: Break cyclic 
dependencies and move to the end!

and mutual `require' 'ediff-util from ediff-init.el and 'ediff-init from 
ediff-util.el? My idea was to suppress loading of .elc files during 
compilation of such files.