2

I am trying to find out if a library has been loaded after another one. For example has the ox-bibtex library been loaded after the org-ref library. I know you can look at fboundp, featurep, but I need to know the order of loading.

I thought I coudl use something like (seq-position obarray 'org-ref-command) but obarray seems to have symbols that are not even loaded.

The reason for this is in this case, the second library is clobbering something in the first library, and I am looking for a way to see what order things have been loaded.

5
  • If library A is clobbering something that only exists in library B, doesn't that prove that A was loaded after B?
    – NickD
    Commented Jan 5, 2021 at 19:34
  • It isn't that straightforward I think. library B is redefining an org-mode link, but this sometimes also shows up that a function name is redefined. Commented Jan 5, 2021 at 19:39
  • Does this answer your question? How to identify the file of an already loaded feature, independently on how the file was loaded?
    – Drew
    Commented Jan 6, 2021 at 0:07
  • @Drew I don't think that answers the question. I need the order they were loaded, not if they were loaded. The functions in that interesting answer show how to find the file it was loaded from I think. What I need is the positions of those files in the load-history. Commented Jan 7, 2021 at 1:58
  • Ok, it's not exactly the same question. It's the same answer, however - the load history is a history, so it tells you both whether and when, showing what's loaded just before and just after. The general question that covers both is something like, "How can I tell whether or when a given library was loaded?" Maybe Someone (TM) will change the original question into a general Q &A...
    – Drew
    Commented Jan 7, 2021 at 5:14

1 Answer 1

4

I remembered load-historywith that, I came up with this that seems to work. Libraries that are loaded more recently have a smaller position (i.e. closer to the beginning of the list).

(let ((org-ref-i (seq-position load-history (assoc (locate-library "org-ref") load-history)) )
      (ox-bibtex-i (seq-position load-history (assoc (locate-library "ox-bibtex") load-history))))
  (and org-ref-i ox-bibtex-i
       (> org-ref-i ox-bibtex-i)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.