X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=egg-edep.el;h=47a16c9775aa215fac9a4f0bce23c9b04778ab75;hb=a97740746fe0daf6d9958480ab645810eeebb49e;hp=8a93a96c6bc8f0104b5d0a414834b63085c77247;hpb=d610e48010add404d74b5afd4e6dfb288e776c43;p=elisp%2Ftamago.git diff --git a/egg-edep.el b/egg-edep.el index 8a93a96..47a16c9 100644 --- a/egg-edep.el +++ b/egg-edep.el @@ -31,40 +31,57 @@ ;;; Code: -(if (and (fboundp 'set-buffer-multibyte) - (subrp (symbol-function 'set-buffer-multibyte))) - ;; Emacs 20.3 +(if (featurep 'xemacs) (progn + (defun egg-characterp (char) + (characterp char)) (defun egg-char-bytes (x) 1) (defun egg-charset-bytes (x) 1) (defun egg-char-bytes-at (str pos) 1) (defun egg-chars-in-period (str pos len) len) (defalias 'egg-string-to-vector 'identity) (defalias 'egg-string-to-char-at 'aref) - ) - ;; Emacs 20.2 - (defun set-buffer-multibyte (flag) - (setq enable-multibyte-characters flag)) - (defalias 'string-as-unibyte 'identity) - (defalias 'string-as-multibyte 'identity) - (defalias 'coding-system-put 'put) - - (defalias 'egg-char-bytes 'char-bytes) - (defalias 'egg-charset-bytes 'charset-bytes) - (defun egg-char-bytes-at (str pos) - (char-bytes (egg-string-to-char-at str pos))) - (defun egg-chars-in-period (str pos len) - (chars-in-string (substring str pos (+ pos len)))) - (defalias 'egg-string-to-vector 'string-to-vector) - (defalias 'egg-string-to-char-at 'sref) - ) + (unless (fboundp 'set-buffer-multibyte) + (defun set-buffer-multibyte (ignored) + nil))) + (if (and (fboundp 'set-buffer-multibyte) + (subrp (symbol-function 'set-buffer-multibyte))) + ;; Emacs 20.3 + (progn + (defun egg-char-bytes (x) 1) + (defun egg-charset-bytes (x) 1) + (defun egg-char-bytes-at (str pos) 1) + (defun egg-chars-in-period (str pos len) len) + (defalias 'egg-string-to-vector 'identity) + (defalias 'egg-string-to-char-at 'aref) + ) + ;; Emacs 20.2 + (defun set-buffer-multibyte (flag) + (setq enable-multibyte-characters flag)) + (defalias 'string-as-unibyte 'identity) + (defalias 'string-as-multibyte 'identity) + (defalias 'coding-system-put 'put) + + (defalias 'egg-char-bytes 'char-bytes) + (defalias 'egg-charset-bytes 'charset-bytes) + (defun egg-char-bytes-at (str pos) + (char-bytes (egg-string-to-char-at str pos))) + (defun egg-chars-in-period (str pos len) + (chars-in-string (substring str pos (+ pos len)))) + (defalias 'egg-string-to-vector 'string-to-vector) + (defalias 'egg-string-to-char-at 'sref) + ) + (defun egg-characterp (char) + (numberp char))) ;; Elisp bug fix (defun egg-next-single-property-change (pos prop &optional object limit) - (if limit - (min limit (next-single-property-change pos prop object (1+ limit))) - (next-single-property-change pos prop object))) + (if (featurep 'xemacs) + (next-single-property-change pos prop object limit) + (if limit + (min limit (next-single-property-change pos prop object (1+ limit))) + (next-single-property-change pos prop object)))) (defun egg-string-match-charset (charset string &optional start) (let ((cur-ct (category-table))