diff options
author | Achim Gratz <Stromeko@Stromeko.DE> | 2013-01-06 18:24:56 +0100 |
---|---|---|
committer | Achim Gratz <Stromeko@Stromeko.DE> | 2013-01-06 18:33:34 +0100 |
commit | 5484a33b8d1382958095922bc9bc2bd6f1d9ffc6 (patch) | |
tree | e1cdb11c59ef404d08eb1b2275e892ec3b54d7e1 | |
parent | 8fcdb5179bbe172b52dd80101efe247de9fe1ac2 (diff) | |
download | org-mode-5484a33b8d1382958095922bc9bc2bd6f1d9ffc6.tar.gz |
Compatibility: Use org-load-noerror-mustsuffix
* lisp/org-macs.el: New macro to allow the 5-argument form of load to
be used where possible without breaking compatibility with XEmacs.
* lisp/org.el (org-version, org-reload): Use
`org-load-noerror-mustsuffix´ instead of adding a fifth argument to
load directly. Guard against undefined variable load-suffixes,
which doesn't exist in XEmacs.
Since load-suffixes doesn't exist in XEmacs, (org-reload 'uncompiled)
will not work. If it doesn't complicate the compatibility macro too
much this can be added later.
-rw-r--r-- | lisp/org-macs.el | 6 | ||||
-rw-r--r-- | lisp/org.el | 20 |
2 files changed, 17 insertions, 9 deletions
diff --git a/lisp/org-macs.el b/lisp/org-macs.el index a44bdbe..e5d6100 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -426,6 +426,12 @@ the value in cdr." (cons (list (car flat) (cadr flat)) (org-make-parameter-alist (cddr flat))))) +(defmacro org-load-noerror-mustsuffix (file) + "Load FILE with optional arguments NOERROR and MUSTSUFFIX. Drop the MUSTSUFFIX argument for XEmacs, which doesn't recognize it." + (if (featurep 'xemacs) + `(load ,file 'noerror) + `(load ,file 'noerror nil nil 'mustsuffix))) + (provide 'org-macs) ;;; org-macs.el ends here diff --git a/lisp/org.el b/lisp/org.el index 28f075a..a446d76 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -78,8 +78,11 @@ (require 'find-func) (require 'format-spec) +(require 'org-macs) +(require 'org-compat) + (let ((load-suffixes (list ".el"))) - (load "org-loaddefs" 'noerror nil nil 'mustsuffix)) + (org-load-noerror-mustsuffix "org-loaddefs")) ;; `org-outline-regexp' ought to be a defconst but is let-binding in ;; some places -- e.g. see the macro org-with-limited-levels. @@ -238,7 +241,6 @@ identifier." :group 'org-id) ;;; Version -(require 'org-compat) (org-check-version) ;;;###autoload @@ -249,13 +251,12 @@ When FULL is non-nil, use a verbose version string. When MESSAGE is non-nil, display a message with the version." (interactive "P") (let* ((org-dir (ignore-errors (org-find-library-dir "org"))) - (save-load-suffixes load-suffixes) + (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes)) (load-suffixes (list ".el")) (org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs"))) (org-trash (or (and (fboundp 'org-release) (fboundp 'org-git-version)) - (load (concat org-dir "org-version") - 'noerror 'nomessage nil 'mustsuffix))) + (org-load-noerror-mustsuffix (concat org-dir "org-version")))) (load-suffixes save-load-suffixes) (org-version (org-release)) (git-version (org-git-version)) @@ -4973,7 +4974,7 @@ This variable is set by `org-before-change-function'. (require 'easymenu) (require 'overlay) -(require 'org-macs) +;; (require 'org-macs) moved higher up in the file before it is first used (require 'org-entities) ;; (require 'org-compat) moved higher up in the file before it is first used (require 'org-faces) @@ -20349,15 +20350,16 @@ With prefix arg UNCOMPILED, load the uncompiled versions." feats))) 'string-lessp) (list "org-version" "org"))) + (load-suffixes (when (boundp 'load-suffixes) load-suffixes)) (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes)) load-uncore load-misses) (setq load-misses (delq 't (mapcar (lambda (f) - (or (load (concat org-dir f) 'noerror nil nil 'mustsuffix) + (or (org-load-noerror-mustsuffix (concat org-dir f)) (and (string= org-dir contrib-dir) - (load (concat contrib-dir f) 'noerror nil nil 'mustsuffix)) - (and (load (concat (org-find-library-dir f) f) 'noerror nil nil 'mustsuffix) + (org-load-noerror-mustsuffix (concat contrib-dir f))) + (and (org-load-noerror-mustsuffix (concat (org-find-library-dir f) f)) (add-to-list 'load-uncore f 'append) 't) f)) |