From 5484a33b8d1382958095922bc9bc2bd6f1d9ffc6 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 18:24:56 +0100 Subject: [PATCH 2/2] Compatibility: Use org-load-noerror-mustsuffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- lisp/org-macs.el | 6 ++++++ 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 @@ (defun org-make-parameter-alist (flat) (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 @@ (defvar org-table-formula-constants-local nil (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 @@ (defcustom org-clone-delete-id nil :group 'org-id) ;;; Version -(require 'org-compat) (org-check-version) ;;;###autoload @@ -249,13 +251,12 @@ (defun org-version (&optional here full message) 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 @@ (defvar buffer-face-mode-face) (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 @@ (defun org-reload (&optional uncompiled) 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)) -- 1.8.1