diff --git a/UTILITIES/org-fixup.el b/UTILITIES/org-fixup.el index f34423b9e..e9483491c 100644 --- a/UTILITIES/org-fixup.el +++ b/UTILITIES/org-fixup.el @@ -54,6 +54,7 @@ the Git work tree)." ;;;\#\#\#autoload \(defconst org-odt-data-dir \"" odt-dir "\" \"The location of ODT styles.\") +\f\n\(provide 'org-version\) \f\n;; Local Variables:\n;; version-control: never ;; no-byte-compile: t ;; coding: utf-8\n;; End:\n;;; org-version.el ends here\n") diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 09a36a20e..51461e8a9 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -443,6 +443,23 @@ With two arguments, return floor and remainder of their quotient." 'condition-case-unless-debug 'condition-case-no-debug)) +(defmacro org-check-version () + "Try very hard to provide sensible version strings." + (let* ((org-dir (org-find-library-dir "org")) + (org-version.el (concat org-dir "org-version.el")) + (org-fixup.el (concat org-dir "../UTILITIES/org-fixup.el"))) + (if (require 'org-version org-version.el 'noerror) + '(progn + (autoload 'org-release "org-version.el") + (autoload 'org-git-version "org-version.el")) + (if (require 'org-fixup org-fixup.el 'noerror) + '(org-fixup) + ;; provide fallback definitions and complain + (warn "Could not define org version correctly. Check installation!") + '(progn + (defun org-release () "N/A") + (defun org-git-version () "N/A !!check installation!!")))))) + (provide 'org-compat) ;;; org-compat.el ends here diff --git a/lisp/org.el b/lisp/org.el index 3ad80cb19..4241168d0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -209,15 +209,7 @@ identifier." :group 'org-id) ;;; Version -;; fallback definitions if everything goes wrong -(defun org-release () "N/A") -(defun org-git-version () "N/A !!check installation!!") -;; re-define them with something sensible if possible -(when (eval-when-compile - (require 'org-fixup - (concat (org-find-library-dir "org") "../UTILITIES/org-fixup.el") - 'noerror)) - (org-fixup)) +(org-check-version) ;;;###autoload (defun org-version (&optional here full message) "Show the org-mode version in the echo area.