Allow org-indent-mode only on Emacsen that do support it

* lisp/org-compat.el (org-version-check): New function.
* lisp/org-indent.el (org-indent-mode): Check for exact emacs version.
This commit is contained in:
Carsten Dominik 2010-07-06 10:23:41 +02:00
parent c80d5b9c27
commit 85c90e96fd
2 changed files with 28 additions and 3 deletions

View File

@ -89,6 +89,30 @@ any other entries, and any resulting duplicates will be removed entirely."
(t specs)))
(put 'org-compatible-face 'lisp-indent-function 1)
(defun org-version-check (version feature level)
(let* ((v1 (mapcar 'string-to-number (split-string version "[.]")))
(v2 (mapcar 'string-to-number (split-string emacs-version "[.]")))
(rmaj (or (nth 0 v1) 99))
(rmin (or (nth 1 v1) 99))
(rbld (or (nth 2 v1) 99))
(maj (or (nth 0 v2) 0))
(min (or (nth 1 v2) 0))
(bld (or (nth 2 v2) 0)))
(if (or (< maj rmaj)
(and (= maj rmaj)
(< min rmin))
(and (= maj rmaj)
(= min rmin)
(< bld rbld)))
(if (eq level :predicate)
;; just return if we have the version
nil
(let ((msg (format "Emacs %s or greater is recommended for %s"
version feature)))
(display-warning 'org msg level)
t))
t)))
;;;; Emacs/XEmacs compatibility
;; Keys

View File

@ -130,10 +130,11 @@ FIXME: How to update when broken?"
(cond
((org-bound-and-true-p org-inhibit-startup)
(setq org-indent-mode nil))
((and org-indent-mode (featurep 'xemacs))
(message "org-indent-mode does not work in XEmacs - refused to turn it on")
(setq org-indent-mode nil))
((and org-indent-mode
(or (< emacs-major-version 23)
(and (= emacs-major-version 23)
(< emacs-minor-version 2))))
(not (org-version-check "23.1.50" "Org Indent mode" :predicate)))
(message "org-indent-mode is can crash Emacs 23.1 - refused to turn it on!")
(ding)
(sit-for 1)