Removed v18 stuff; now we require 'poe.
[elisp/apel.git] / poe.el
diff --git a/poe.el b/poe.el
index b65246f..1059128 100644 (file)
--- a/poe.el
+++ b/poe.el
@@ -204,6 +204,12 @@ See also the function `defconst'."
 ;;; `eval-when-compile' is defined in "poe-18" under v18 with old compiler.
 (eval-when-compile (require 'static))
 
+;; `file-coding' was appeared in the spring of 1998, just before XEmacs
+;; 21.0.  Therefore it is not provided in XEmacs with MULE versions 20.4
+;; or earlier.
+(if (and (featurep 'xemacs) (featurep 'mule))
+    (provide 'file-coding))
+
 ;; imported from emacs-20.3/lisp/emacs-lisp/edebug.el.
 ;; `def-edebug-spec' is an autoloaded macro in v19 and later.
 (defmacro-maybe def-edebug-spec (symbol spec)
@@ -215,6 +221,17 @@ Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol
 (def-edebug-spec defun-maybe defun)
 (def-edebug-spec defmacro-maybe defmacro)
 (def-edebug-spec defsubst-maybe defun)
+(def-edebug-spec defun-maybe-cond
+  (&define name lambda-list
+          [&optional stringp]
+          [&rest ([&not eval] [&rest sexp])]
+          [&optional (eval [&optional ("interactive" interactive)] def-body)]
+          &rest (&rest sexp)))
+(def-edebug-spec defmacro-maybe-cond
+  (&define name lambda-list
+          [&rest ([&not eval] [&rest sexp])]
+          [&optional (eval def-body)]
+          &rest (&rest sexp)))
 
 ;;; Emacs 20.1 emulation
 
@@ -287,12 +304,14 @@ See `read-from-minibuffer' for details of HISTORY argument."
 (defun-maybe rassoc (key list)
   "Return non-nil if KEY is `equal' to the cdr of an element of LIST.
 The value is actually the element of LIST whose cdr equals KEY.
+Elements of LIST that are not conses are ignored.
 \[Emacs 19.29 emulating function]"
   (catch 'found
     (while list
-      (if (equal (cdr (car list)) key)
-         (throw 'found (car list)))
-      (setq list (cdr list)))))
+      (cond ((not (consp (car list))))
+           ((equal (cdr (car list)) key)
+            (throw 'found (car list)) ))
+      (setq list (cdr list)) )))
 
 ;; imported from emacs-19.34/lisp/files.el.
 (defun-maybe file-name-sans-extension (filename)
@@ -366,6 +385,28 @@ Value is nil if OBJECT is not a buffer or if it has been killed.
              (cons 'progn body)
              (list 'select-window 'save-selected-window-window))))
 
+(defun-maybe-cond convert-standard-filename (filename)
+  "Convert a standard file's name to something suitable for the current OS.
+This function's standard definition is trivial; it just returns the argument.
+However, on some systems, the function is redefined
+with a definition that really does change some file names.
+Under `windows-nt' or `ms-dos', it refers `filename-replacement-alist' and
+`filename-limit-length' for the basic filename and each parent directory name.
+\[Emacs 19.31 emulating function]"
+  ((memq system-type '(windows-nt ms-dos))
+   (require 'filename)
+   (let* ((names (split-string filename "/"))
+         (drive-name (car names))
+         (filter (function (lambda (string)
+                             (filename-maybe-truncate-by-size
+                              (filename-special-filter string))))))
+     (cond ((eq 1 (length names))
+           (funcall filter drive-name))
+          ((string-match "^[^/]:$" drive-name)
+           (concat drive-name "/" (mapconcat filter (cdr names) "/")))
+          (t (mapconcat filter names "/")))))
+  (t filename))
+
 
 ;;; @ Emacs 20.1 emulation
 ;;;