| 1998-10-13 Holger Schauer <schauer(a)coling.uni-freiburg.de> list.xemacs
| >>>>"sb" == SL Baur schrieb am 10 Oct 1998 00:14:28 -0700:
|
| sb> Dang it! We don't want people writing version number tests!
| sb> They should be writing feature tests.
|
| (defun running-emacs-version-or-newer (major minor)
| (or (> emacs-major-version major)
| (and (= emacs-major-version major)
| (>= emacs-minor-version minor))))
|
| feature-tests are IMHO not enough. There are some people who need to
| support different emacs-versions using different packages (and
| different versions, of course). So, there will be people who will need
| to support such version number tests, but hey, I guess, that they will
| be able to write three-digits-version tests anyway (however, they will
| be annoyed to death if they have to. I can't think of an instance
| where one would be forced to do).
I just checked my code and suprised: I haven only 1% need to check the
explicit X/Emacs version number to support NT/Emacs 19.28 - 20.x and
XEmacs 19.14 - 21.x.
What was extremeny used was the MULE/NON-MULE Emacs tests that I have
separated with double "pp" tests. There were so radical changes between
19 and 20 trunks. Interestingly change from XEmacs 20 to 21 didn't need
any additional compatibility tests (the documentation for xemacs-pp
function is bit out of date in regad to Xemacs 21.)
In case anyone would think including these function into XEmacs would
be useful; here are my Emacs tests.
jari
(eval-and-compile
;; cl.el version 3.0 does not define macro `return' cl 2.02(19.34) is ok.
;; This was noticed by Sami Khoury <skhoury(a)cse.dnd.ca>
(require 'cl)
(require 'backquote)
(unless (fboundp 'return)
(error "\
** tinylibb.el: You 'cl package is dysfunctional. Get some other version"))
;; ..................................................... &presettings ...
;; We have to put these functions inside here, because
;; we later use construct
;;
;; (eval-and-compile
;; (when (xemacs-p)
;; (autoload ....
;;
;; And that doesn't succeed, because Compiler doesn't yet know
;; that xemacs-p exists inside eval-and-compile. By putting the
;; definitions here; the compiler is gurranteed to see them.
(defsubst xemacs-p ()
"Check if running XEmacs. Return main revision as integer (eg. 19)."
(if (or (boundp 'xemacs-logo)
(featurep 'xemacs)) ;Appeared in 20.2+
emacs-major-version))
(defsubst xemacs-pp ()
"Check XEmacs 20.x Return minor version 20.x"
(and (boundp 'xemacs-logo)
(> emacs-major-version 19)
emacs-minor-version))
(defsubst emacs-p ()
"Check if running Emacs."
(if (not (boundp 'xemacs-logo))
emacs-major-version))
(defsubst emacs-pp ()
"Check if running Emacs 20.x and return minor version 20.x"
(and (not (boundp 'xemacs-logo))
(> emacs-major-version 19)
emacs-minor-version))
(defsubst emacs-version-number-as-string ()
"Emacs and XEmacs compatibility. Return plain version number string."
(if (emacs-p)
emacs-version ; "19.34"
;; XEmacs return "19.14 XEmacs Lucid", get only version
(and (string-match "^\\([0-9]+\\.[0-9.]+\\)" emacs-version)
(substring emacs-version 0 (match-end 1)) )))
(defsubst win32-p ()
(cond
((fboundp 'console-type)
(eq (let ((f 'console-type)) (funcall f)) ;Quiet Emacs byte compiler
'win32))
((boundp 'window-system)
(eq (symbol-value 'window-system) 'win32))
((error "Internal alert, contact maintainer of TinyLib."))))
;; Use defvar to silence byteCompiler
(defvar byte-compile-dynamic nil "19.29 var")
(make-local-variable 'byte-compile-dynamic)
(setq byte-compile-dynamic t) ;19.29+
)