XEmacs compatibility improvements

* lisp/org-compat.el (org-find-library-dir): rename
  org-find-library-name (misleading) and implement with a function
  that exists identically in Emacs/XEmacs.

* UTILITIES/org-fixup.el: change calls to org-find-library-dir.
  Simplify invocations of git, use the same arguments as in targets.mk
  and use only functions that work the same in EMacs and XEmacs.

* lisp/org-exp-blocks.el: change calls to org-find-library-dir.

* lisp/org.el: change calls to org-find-library-dir.  Make require for
  noutline fail silently because it is missing from XEmacs.
This commit is contained in:
Achim Gratz 2012-05-07 22:37:31 +02:00 committed by Bastien Guerry
parent e7d2e4e186
commit 4f29c630d8
4 changed files with 27 additions and 30 deletions

View File

@ -68,12 +68,12 @@
(defmacro org-fixup ()
(let* ((origin default-directory)
(dirlisp (org-find-library-name "org"))
(dirlisp (org-find-library-dir "org"))
(dirorg (concat dirlisp "../" ))
(dirgit (concat dirorg ".git/" ))
(org-version "N/A-fixup")
(org-git-version "N/A-fixup !!check installation!!"))
(if (load (concat dirlisp "org-version.el") 'noerror 'nomessage 'nosuffix 'mustsuffix)
(if (load (concat dirlisp "org-version.el") 'noerror 'nomessage 'nosuffix)
(setq org-version (org-release)
org-git-version (org-git-version))
(when (and (file-exists-p dirgit)
@ -81,23 +81,23 @@
(unwind-protect
(progn
(cd dirorg)
(when (eql 0 (shell-command "git describe --abbrev=6 HEAD"))
(with-current-buffer "*Shell Command Output*"
(goto-char (point-min))
(setq git-version (buffer-substring (point) (point-at-eol))))
(when (string-match "\\S-"
(shell-command-to-string
"git diff-index --name-only HEAD --"))
(setq git-version (concat git-version "-dirty")))
(setq org-version (and (string-match "_\\([^-]+\\)-" git-version)
(match-string 1 git-version)))
(setq org-git-version git-version)))
(cd origin))))
(setq org-git-version
(concat (substring
(shell-command-to-string "git describe --abbrev=6 HEAD")
0 -1)
(when (string-match "\\S-"
(shell-command-to-string
"git status -uno --porcelain"))
".dirty")))
(setq org-version
(substring
(shell-command-to-string "git describe --abbrev=0 HEAD")
0 -1))))
(cd origin)))
`(progn
(defun org-release () ,org-version)
(defun org-git-version () ,org-git-version)
"org-fixup.el: redefined org version."
)))
"org-fixup.el: redefined org version.")))
(provide 'org-fixup)

View File

@ -330,12 +330,8 @@ Works on both Emacs and XEmacs."
(org-no-properties (substring string (or from 0) to))
(substring-no-properties string from to)))
(defmacro org-find-library-name (library)
(if (fboundp 'find-library-name)
`(file-name-directory (find-library-name ,library))
; XEmacs does not have `find-library-name'
`(flet ((flnh (lib ignore) lib))
(file-name-directory (find-library ,library nil 'flnh)))))
(defmacro org-find-library-dir (library)
`(file-name-directory (locate-library ,library)))
(defun org-count-lines (s)
"How many lines in string S?"

View File

@ -240,7 +240,7 @@ which defaults to the value of `org-export-blocks-witheld'."
(file-name-as-directory
(expand-file-name
"../contrib"
(file-name-directory (org-find-library-name "org")))))))
(file-name-directory (org-find-library-dir "org")))))))
"Path to the ditaa jar executable."
:group 'org-babel
:type 'string)

View File

@ -89,7 +89,8 @@
(unless (boundp 'diary-fancy-buffer)
(defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)))
(require 'outline) (require 'noutline)
(require 'outline)
(require 'noutline "noutline" 'noerror) ;; stock XEmacs does not have it
;; Other stuff we need.
(require 'time-date)
(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
@ -211,16 +212,16 @@ identifier."
(eval-when-compile
(defun org-release () "N/A")
(defun org-git-version () "N/A !!check installation!!")
(and (load (concat (org-find-library-name "org") "../UTILITIES/org-fixup.el")
'noerror 'nomessage 'nosuffix 'mustsuffix)
(and (load (concat (org-find-library-dir "org") "../UTILITIES/org-fixup.el")
'noerror 'nomessage 'nosuffix)
(org-fixup)))
;;;###autoload
(defun org-version (&optional here)
"Show the org-mode version in the echo area.
With prefix arg HERE, insert it at point."
(interactive "P")
(let* ((org-dir (ignore-errors (org-find-library-name "org")))
(org-install-dir (ignore-errors (org-find-library-name "org-install.el")))
(let* ((org-dir (ignore-errors (org-find-library-dir "org")))
(org-install-dir (ignore-errors (org-find-library-dir "org-install.el")))
(org-version (org-release))
(git-version (org-git-version))
(version (format "Org-mode version %s (%s @ %s)"
@ -19581,10 +19582,10 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
(interactive "P")
(require 'find-func)
(let* ((file-re "^\\(org\\|orgtbl\\)\\(\\.el\\|-.*\\.el\\)")
(dir-org (file-name-directory (org-find-library-name "org")))
(dir-org (file-name-directory (org-find-library-dir "org")))
(dir-org-contrib (ignore-errors
(file-name-directory
(org-find-library-name "org-contribdir"))))
(org-find-library-dir "org-contribdir"))))
(babel-files
(mapcar (lambda (el) (concat "ob" (when el (format "-%s" el)) ".el"))
(append (list nil "comint" "eval" "exp" "keys"