summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2012-05-07 22:37:31 +0200
committerBastien Guerry <bzg@altern.org>2012-05-18 07:45:45 +0200
commit4f29c630d8dd92a37ea177e594d9e15d3d590464 (patch)
treee3f51798a82ca60dbf8b8fd68c0eb764c78163b9
parente7d2e4e18694cb8c4bec5a81815bf7ef9c8078a6 (diff)
downloadorg-mode-4f29c630d8dd92a37ea177e594d9e15d3d590464.tar.gz
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.
-rw-r--r--UTILITIES/org-fixup.el32
-rw-r--r--lisp/org-compat.el8
-rw-r--r--lisp/org-exp-blocks.el2
-rw-r--r--lisp/org.el15
4 files changed, 27 insertions, 30 deletions
diff --git a/UTILITIES/org-fixup.el b/UTILITIES/org-fixup.el
index 9d0dfa2..a7e64b1 100644
--- a/UTILITIES/org-fixup.el
+++ b/UTILITIES/org-fixup.el
@@ -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)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index d468942..0cdb6af 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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?"
diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
index d671436..b0bcc37 100644
--- a/lisp/org-exp-blocks.el
+++ b/lisp/org-exp-blocks.el
@@ -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)
diff --git a/lisp/org.el b/lisp/org.el
index 8825d6c..3ed14d7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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"