ensure that M-x org-version always delivers something useful
commite7d2e4e18694cb8c4bec5a81815bf7ef9c8078a6
authorAchim Gratz <Stromeko@Stromeko.DE>
Mon, 7 May 2012 19:21:28 +0000 (7 21:21 +0200)
committerBastien Guerry <bzg@altern.org>
Fri, 18 May 2012 05:45:45 +0000 (18 07:45 +0200)
tree4f4f3bb9904a8e6bb78e44511491699231434830
parentbcced6a51d792f79afd4bb3b366820ec28759664
ensure that M-x org-version always delivers something useful

* UTILITIES/org-fixup.el (org-make-org-version): change defconst to
  defun for org-release and org-git-version and close over those
  variables (do not make them global anymore).

* UTILITIES/org-fixup.el (org-fixup): check for org-version.el or try
  to use git to get the version from the worktree (code uses parts of
  the former implementation from org.el).

* lisp/org.el (org-version): use functions instead of global variables
  to get the version strings and remove the defvaralias to
  org-version.  Warn when encountering a mixed installation (org and
  org-install.el should be found in the same directory).

Supported use-cases:

1) Org uninstalled (and possibly uncompiled) from Git or tarball.

1a) No org-version.el or org-install.el exists in worktree.  Partially
supported configuration, org version is determined from git if
possible via UTILITIES/org-fixup.el.  However, Emacs versions
delivered with orgmode will provide autoloads that may or may not work
with that version of org (mixed installation).  If such a situation is
encountered, warn the user.  It can work if the autoloads from the
installation match the ones that would be generated for the worktree,
which generelly is only the case if there is a relatively recent
installation in site-lisp.

1b) Autoload file org-install.el exists in worktree.  Fully supported
configuration, org version is determined from git if possible via
UTILITIES/org-fixup.el.

1c) Both org-version.el or org-install.el exist in worktree.
Recommended configuration for 1), org version is taken from
org-version.el (git never gets invoked).

2) Org installed.  Both org-version.el and org-install.el must exist
in install directory.  Only supported configuration for 2), org
version is taken from org-version.el (git never gets invoked since
UTILITIES/org-fixup.el is not available).

Any unsupported configuration should still yield a version string, but
it will contain "N/A" to alert the user about a botched org
installation.
UTILITIES/org-fixup.el
lisp/org.el