Compatibility: fix XEmacs compilation failures

* lisp/ob-eval.el, lisp/ob.el, lisp/org-macro.el, lisp/org-mhe.el:
  Require org-macs and org-compat as necessary.
* lisp/ob-tangle.el: Declare function `org-store-link' and
  `org-open-link-from-string'.
* lisp/org-compat.el: Extend eval-and-compile clause and add advices
  for functions that have different parameter lists in XEmacs. Add
  variable definitions that XEmacs lacks .
* lisp/org-macs.el (declare-function): Define macro to use autoload
  instead for XEmacs.
* lisp/ox-html.el, lisp/ox-odt.el: XEmacs does not have table.el, so
  use 'noerror on the require form.
* lisp/ox-texinfo.el (org-texinfo-table-column-widths): Fix spliced
  argument list that XEmacs complains about by adding parenthesis.

This fixes all compilation failures on XEmacs and warnings related to
Org that indicate that XEmacs has compiled things wrongly (for
instance it might have interpreted a function as a variable symbol).
There are still many warnings that probably indicate serious problems.
This commit is contained in:
Achim Gratz 2013-06-01 11:21:48 +02:00
parent 0e42f1aae1
commit d36a933c65
10 changed files with 44 additions and 11 deletions

View File

@ -27,6 +27,7 @@
;; shell commands.
;;; Code:
(require 'org-macs)
(eval-when-compile (require 'cl))
(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")

View File

@ -32,6 +32,8 @@
(declare-function org-edit-special "org" (&optional arg))
(declare-function org-link-escape "org" (text &optional table))
(declare-function org-store-link "org" (arg))
(declare-function org-open-link-from-string "org" (s &optional arg reference-buffer))
(declare-function org-heading-components "org" ())
(declare-function org-back-to-heading "org" (invisible-ok))
(declare-function org-fill-template "org" (template alist))

View File

@ -22,6 +22,8 @@
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(require 'org-macs)
(require 'org-compat)
(require 'ob-eval)
(require 'ob-core)
(require 'ob-comint)

View File

@ -113,18 +113,41 @@ any other entries, and any resulting duplicates will be removed entirely."
;;;; Emacs/XEmacs compatibility
(defun org-defvaralias (new-alias base-variable &optional docstring)
"Compatibility function for defvaralias.
Don't do the aliasing when `defvaralias' is not bound."
(declare (indent 1))
(when (fboundp 'defvaralias)
(defvaralias new-alias base-variable docstring)))
(eval-and-compile
(defun org-defvaralias (new-alias base-variable &optional docstring)
"Compatibility function for defvaralias.
Don't do the aliasing when `defvaralias' is not bound."
(declare (indent 1))
(when (fboundp 'defvaralias)
(defvaralias new-alias base-variable docstring)))
(when (and (not (boundp 'user-emacs-directory))
(boundp 'user-init-directory))
(org-defvaralias 'user-emacs-directory 'user-init-directory)))
(when (featurep 'xemacs)
(defadvice custom-handle-keyword
(around org-custom-handle-keyword (symbol keyword value type)
activate preactivate)
"Remove custom keywords not recognized to avoid producing an error."
(cond
((eq keyword :package-version))
(t ad-do-it)))
(defadvice define-obsolete-variable-alias
(around org-define-obsolete-variable-alias
(obsolete-name current-name &optional docstring)
activate preactivate)
"Declare arguments defined in later versions of Emacs."
ad-do-it)
(defadvice define-obsolete-function-alias
(around org-define-obsolete-function-alias
(obsolete-name current-name when &optional docstring)
activate preactivate)
"Declare arguments defined in later versions of Emacs."
ad-do-it)
(defvar customize-package-emacs-version-alist nil)
(defvar temporary-file-directory (temp-directory)))
;; Keys
(defconst org-xemacs-key-equivalents
'(([mouse-1] . [button1])

View File

@ -37,12 +37,14 @@
;; {{{email}}} and {{{title}}} macros.
;;; Code:
(require 'org-macs)
(declare-function org-element-at-point "org-element" (&optional keep-trail))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-remove-double-quotes "org" (s))
(declare-function org-mode "org" ())
(declare-function org-file-contents "org" (file &optional noerror))
(declare-function org-with-wide-buffer "org-macs" (&rest body))

View File

@ -33,7 +33,9 @@
(eval-and-compile
(unless (fboundp 'declare-function)
(defmacro declare-function (fn file &optional arglist fileonly)))
(defmacro declare-function (fn file &optional arglist fileonly)
`(autoload ',fn ,file)))
(if (>= emacs-major-version 23)
(defsubst org-char-to-string(c)
"Defsubst to decode UTF-8 character values in emacs 23 and beyond."

View File

@ -30,6 +30,7 @@
;;; Code:
(require 'org-macs)
(require 'org)
;; Customization variables

View File

@ -37,7 +37,7 @@
(require 'ox)
(require 'ox-publish)
(require 'format-spec)
(eval-when-compile (require 'cl) (require 'table))
(eval-when-compile (require 'cl) (require 'table nil 'noerror))
;;; Function Declarations

View File

@ -27,7 +27,7 @@
(eval-when-compile
(require 'cl)
(require 'table))
(require 'table nil 'noerror))
(require 'format-spec)
(require 'ox)
(require 'org-compat)

View File

@ -1550,7 +1550,7 @@ a communication channel."
(nth count item))) counts)
(mapconcat (lambda (size)
(make-string size ?a)) (mapcar (lambda (ref)
(apply 'max `,@ref)) (car counts))
(apply 'max `(,@ref))) (car counts))
"} {")))
(defun org-texinfo-table--org-table (table contents info)