X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=poe.el;h=aeb7d68198701d36ae4ee227b929b72d9cece086;hb=c946bef26333f1127c0f9202beb355a7a81d734b;hp=d45005e55caa319ad0fad9f26fab51c7013f3ebe;hpb=ad3ba73586a7e06f1311726585c1e2c86995bda2;p=elisp%2Fapel.git diff --git a/poe.el b/poe.el index d45005e..aeb7d68 100644 --- a/poe.el +++ b/poe.el @@ -32,29 +32,13 @@ (require 'pym) + ;;; @ Version information. ;;; -;; v18 does not have many features we expect, -;; notably `eval-when-compile' and `eval-and-compile'. -(static-when (string= (substring emacs-version 0 2) "18") +(static-when (= emacs-major-version 18) (require 'poe-18)) -;; Now we can use them! -(eval-and-compile - ;; We must define these two constants at compile-time as well as - ;; load-time since they are used for compile-time version checking. - (defconst-maybe emacs-major-version - (progn (string-match "^[0-9]+" emacs-version) - (string-to-int (substring emacs-version - (match-beginning 0)(match-end 0)))) - "Major version number of this version of Emacs.") - (defconst-maybe emacs-minor-version - (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version) - (string-to-int (substring emacs-version - (match-beginning 1)(match-end 1)))) - "Minor version number of this version of Emacs.")) - ;; Some ancient version of XEmacs did not provide 'xemacs. (static-when (string-match "XEmacs" emacs-version) (provide 'xemacs)) @@ -85,7 +69,7 @@ (progn (require 'nofeature "nofile" 'noerror) (if (get 'require 'defun-maybe) - (error ""))) ; already redefined. + (error "`require' is already redefined"))) (error ;; load-time check. (or (fboundp 'si:require) @@ -204,8 +188,8 @@ See `read-from-minibuffer' for details of HISTORY argument." ;; compile-time check. (if (= (string-to-number "1e1" 16) 481) (if (get 'string-to-number 'defun-maybe) - (error "")) ; already redefined. - (error "")) ; Emacs 20.3 and ealier. + (error "`string-to-number' is already redefined")) + (error "`string-to-number' is broken")) (error ;; load-time check. (or (fboundp 'si:string-to-number) @@ -286,7 +270,7 @@ If the base used is not 10, floating point is not recognized." (progn (char-before) (if (get 'char-before 'defun-maybe) - (error ""))) ; already defined. + (error "`char-before' is already defined"))) (wrong-number-of-arguments ; Mule. ;; load-time check. (or (fboundp 'si:char-before) @@ -351,7 +335,7 @@ If POS is out of range, the value is nil." (progn (char-after) (if (get 'char-after 'defun-maybe) - (error ""))) ; already defined. + (error "`char-after' is already redefined"))) (wrong-number-of-arguments ; v18, v19 ;; load-time check. (or (fboundp 'si:char-after) @@ -559,6 +543,15 @@ Elements of LIST that are not conses are ignored." (throw 'found (car list)))) (setq list (cdr list))))) +;;; Define `functionp' here because "localhook" uses it. + +;; Emacs 20.1/XEmacs 20.3 (but first appeared in Epoch?): (functionp OBJECT) +(defun-maybe functionp (object) + "Non-nil if OBJECT is a type of object that can be called as a function." + (or (subrp object) (byte-code-function-p object) + (eq (car-safe object) 'lambda) + (and (symbolp object) (fboundp object)))) + ;;; @@ Hook manipulation functions. ;; "localhook" package is written for Emacs 19.28 and earlier. @@ -809,13 +802,6 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (setq parts (cons (substring string start (match-beginning 0)) parts) start (match-end 0))) (nreverse (cons (substring string start) parts)))) - -;; Emacs 20.1/XEmacs 20.3 (but first appeared in Epoch?): (functionp OBJECT) -(defun-maybe functionp (object) - "Non-nil if OBJECT is a type of object that can be called as a function." - (or (subrp object) (byte-code-function-p object) - (eq (car-safe object) 'lambda) - (and (symbolp object) (fboundp object)))) ;;; @ Window commands emulation. (lisp/window.el)