From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: Opening (for the first time) a 10-line Org doc takes 4 seconds Date: Wed, 19 Dec 2012 16:09:20 +0100 Message-ID: <878v8ujcyn.fsf@Rainer.invalid> References: <80licv564w.fsf@somewhere.org> <87obhrrl44.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlLHC-0006Vm-7a for emacs-orgmode@gnu.org; Wed, 19 Dec 2012 10:09:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlLH5-0003DZ-AA for emacs-orgmode@gnu.org; Wed, 19 Dec 2012 10:09:42 -0500 Received: from plane.gmane.org ([80.91.229.3]:46739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlLH5-0003DK-3g for emacs-orgmode@gnu.org; Wed, 19 Dec 2012 10:09:35 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TlLHE-0002lm-TB for emacs-orgmode@gnu.org; Wed, 19 Dec 2012 16:09:44 +0100 Received: from pd9eb3c81.dip.t-dialin.net ([217.235.60.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Dec 2012 16:09:44 +0100 Received: from Stromeko by pd9eb3c81.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 19 Dec 2012 16:09:44 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bastien writes: >> (if (locate-library "org-loaddefs") >> (require 'org-loaddefs) > ^^^^^^^^^^^^^ > > You don't need this, there is (load "org-loaddefs.el" t t) in org.el. Well, yes he does when he is using Org from Git. It's a wash when he's using builtin Org from Emacs and potentially wrong when he's using Org from ELPA, depending on if he does it before or after package-initialize. You've expressed before that you want to know why this is so. As a reminder, Org from Git currently has all its autoload definitions in org-loaddefs. Lets look at this for all possible Emacs versions: XEmacs and Emacs 22 don't come with a builtin Org version. You have no autoloads including none for the entry point for the major mode until you load org-loaddefs (or org). Emacs 23, 24.1 and 24.2 comes with older versions of Org that don't even have org-loaddefs. All autoloads for the builtin version are in loaddefs from Emacs and they are already loaded when the user initialization stuff is run. Some things in those autoloads happen to point to the correct libraries, but only by chance. Generally one has to assume that the autoloads that are present have the wrong docstring, point to the wrong file and present an outdated API. To fix this, one must load org-loaddefs (or org). Emacs 24.3 will come with a newer version of Org, but still older than the one from Git. Only part of the autoloads are present in loaddefs, the rest would be pulled in from the bundled org-loaddefs when org is loaded. That is the reason why one does not need to do that when only using the builtin Org version. Again however, these builtin autoload definitions from loaddefs must be presumed outdated for Org from Git, so it is still necessary to load org-loaddefs (or org) in the initalization code to make sure the correct first-level autoloads take precedence even when it is assured that all autoload code-paths also trigger loading of org (I don't think that this can be easily guaranteed and I know of no tool that would allow one to analyse). Last but not least, if one uses Org from ELPA, then it must be arranged that org-loaddefs gets loaded only after package-initialize, otherwise you'll end up with the correct first-level autoloads, but outdated second-level autoloads (that get replaced with the current ones when org gets loaded). Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ DIY Stuff: http://Synth.Stromeko.net/DIY.html