Mark "org-version-check" obsolete

* lisp/org-compat.el (org-version-check): Mark as obsolete.
(org-no-popups):
* testing/examples/babel.org: Remove use of `org-version-check'.
This commit is contained in:
Nicolas Goaziou 2018-04-29 11:53:37 +02:00
parent 31afe4b718
commit a2994cb005
2 changed files with 24 additions and 50 deletions

View File

@ -283,13 +283,13 @@ See `org-link-parameters' for documentation on the other parameters."
;; Not used since commit 6d1e3082, Feb 2010. ;; Not used since commit 6d1e3082, Feb 2010.
(make-obsolete 'org-table-recognize-table.el (make-obsolete 'org-table-recognize-table.el
"please notify the Org mailing list if you use this function." "please notify Org mailing list if you use this function."
"Org 9.0") "Org 9.0")
(defmacro org-preserve-lc (&rest body) (defmacro org-preserve-lc (&rest body)
(declare (debug (body)) (declare (debug (body))
(obsolete "please notify the Org mailing list if you use this function." (obsolete "please notify Org mailing list if you use this function."
"Org 9.0")) "Org 9.2"))
(org-with-gensyms (line col) (org-with-gensyms (line col)
`(let ((,line (org-current-line)) `(let ((,line (org-current-line))
(,col (current-column))) (,col (current-column)))
@ -298,6 +298,12 @@ See `org-link-parameters' for documentation on the other parameters."
(org-goto-line ,line) (org-goto-line ,line)
(org-move-to-column ,col))))) (org-move-to-column ,col)))))
(defun org-version-check (version &rest _)
"Non-nil if VERSION is lower (older) than `emacs-version'."
(declare (obsolete "use `version<' or `fboundp' instead."
"Org 9.2"))
(version< version emacs-version))
(defun org-remove-angle-brackets (s) (defun org-remove-angle-brackets (s)
(org-unbracket-string "<" ">" s)) (org-unbracket-string "<" ">" s))
(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "Org 9.0") (make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "Org 9.0")
@ -441,30 +447,6 @@ use of this function is for the stuck project list."
;;; Miscellaneous functions ;;; Miscellaneous functions
(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)))
(defun org-get-x-clipboard (value) (defun org-get-x-clipboard (value)
"Get the value of the X or Windows clipboard." "Get the value of the X or Windows clipboard."
(cond ((and (eq window-system 'x) (cond ((and (eq window-system 'x)
@ -559,14 +541,9 @@ Pass COLUMN and FORCE to `move-to-column'."
(or (file-remote-p file 'localname) file)))) (or (file-remote-p file 'localname) file))))
(defmacro org-no-popups (&rest body) (defmacro org-no-popups (&rest body)
"Suppress popup windows. "Suppress popup windows and evaluate BODY."
Let-bind some variables to nil around BODY to achieve the desired `(let (pop-up-frames display-buffer-alist)
effect, which variables to use depends on the Emacs version." ,@body))
(if (org-version-check "24.2.50" "" :predicate)
`(let (pop-up-frames display-buffer-alist)
,@body)
`(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function)
,@body)))
;;;###autoload ;;;###autoload
(defmacro org-check-version () (defmacro org-check-version ()

View File

@ -112,21 +112,18 @@
#+name: pascals-triangle #+name: pascals-triangle
#+begin_src emacs-lisp :var n=5 :exports both #+begin_src emacs-lisp :var n=5 :exports both
(require 'cl) (require 'cl)
(defalias 'my-map (if (org-version-check "24.2.50" "cl" :predicate) (defun pascals-triangle (n)
'cl-map (if (= n 0)
'map)) (list (list 1))
(defun pascals-triangle (n) (let* ((prev-triangle (pascals-triangle (- n 1)))
(if (= n 0) (prev-row (car (reverse prev-triangle))))
(list (list 1)) (append prev-triangle
(let* ((prev-triangle (pascals-triangle (- n 1))) (list (cl-map 'list #'+
(prev-row (car (reverse prev-triangle)))) (append prev-row '(0))
(append prev-triangle (append '(0) prev-row)))))))
(list (my-map 'list #'+
(append prev-row '(0)) (pascals-triangle n)
(append '(0) prev-row)))))))
(pascals-triangle n)
#+end_src #+end_src
* calling code blocks from inside table * calling code blocks from inside table