Morgan Smith <[email protected]> writes:

>> We are going to reduce top-level requires, not increase.
>> The time to load Org is already too large, especially with debug Emacs 
>> builds.
>> Although, for the purposes for compilation, it should be possible to
>> leave top-level requires behind (eval-when-compile ...).
>
> If you are going to accomplish this by splitting things into smaller
> files then it sounds like a dependency tree would be a great asset that
> could aid in parallel compilations.

That's the plan. I really want to find some time and slowly port what I
have already done in this area in refactor branch back to main.
But I struggle to keep up with bug reports and patch reviews (despite
all the help from you, contributor liaisons, and others who offer their
help).

>> I do not buy "seems to work". We have struggled from circular
>> dependencies for years now. Nothing is simple in this area.
>> And do note that it is very deliberate that we emit a very loud warning
>> when loaddefs is not available. The fact that things work for you does
>> not mean that they will work universally. If anything, consider the case
>> when loaddefs is missing and Emacs will load org-loaddefs from built-in
>> Org. That will be a disaster.
>
> I think I can solve this using Tup.  Or at least make a lot of progress.
> Tup (https://gittup.org/tup/) creates a FUSE filesystem so it can detect
> the usage of all files.
>
> While I have successfully built and tested org using Tup and a strict
> dependency tree, there where some caveats.  I'll have to send in a write
> up about this at a later date.

Looking forward. I am not quite sure how it would work given that Org
has cyclic dependencies.

> But as far as I can tell, if we disable `org-babel-do-load-languages'
> and `org-load-export-backends', then there is no circular dependencies
> at all.

That's not true. There is a huge number of cyclic dependencies. For
example, org.el depends on org-element.el, which depends on org.el.

(defun org-set-modules (var value)
  "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
  (set-default-toplevel-value var value)
  (when (featurep 'org)
    (org-load-modules-maybe 'force)
    ;; FIXME: We can't have all the requires at top-level due to
    ;; circular dependencies.  Yet, this function might sometimes be
    ;; called when 'org-element is not loaded.
    (require 'org-element)
    (org-element-cache-reset 'all)))

I had to pull rabbit out of hat in some cases and completely rewrite the
logic to solve some more tricky ones on refactor branch.

> Perhaps I need to do more research, but I believe we don't need to load
> the loaddefs file.

You need to unless you substitute it with huge number of
declare-function lines. Or you will get lots of compile warnings.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to