Sync with apel-10_3-1.
[elisp/lemi.git] / emacs-lisp / path-util.el
index 385aecd..034fd17 100644 (file)
@@ -1,6 +1,6 @@
 ;;; path-util.el --- Emacs Lisp file detection utility
 
-;; Copyright (C) 1996,1997,1999 Free Software Foundation, Inc.
+;; Copyright (C) 1996,1997,1999,2000,2002 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <tomo@m17n.org>
 ;; Keywords: file detection, install, module
@@ -24,6 +24,8 @@
 
 ;;; Code:
 
+;; (require 'poe)
+
 (defvar default-load-path load-path
   "*Base of `load-path'.
 It is used as default value of target path to search file or
@@ -36,7 +38,7 @@ directories and it does not exist in `load-path'.
 
 You can use following PATH styles:
        load-path relative: \"PATH/\"
-                       (it is searched from `defaul-load-path')
+                       (it is searched from `default-load-path')
        home directory relative: \"~/PATH/\" \"~USER/PATH/\"
        absolute path: \"/HOO/BAR/BAZ/\"
 
@@ -52,18 +54,16 @@ You can specify following OPTIONS:
               (while rest
                 (setq p (expand-file-name path (car rest)))
                 (if (file-directory-p p)
-                    (throw 'tag p)
-                  )
-                (setq rest (cdr rest))
-                ))
-            (not (member p load-path))
-            )
+                    (throw 'tag p))
+                (setq rest (cdr rest))))
+            (not (or (member p load-path)
+                     (if (string-match "/$" p)
+                         (member (substring p 0 (1- (length p))) load-path)
+                       (member (file-name-as-directory p) load-path)))))
        (setq load-path
              (if (memq 'append options)
                  (append load-path (list p))
-               (cons p load-path)
-               ))
-      )))
+               (cons p load-path))))))
 
 ;;;###autoload
 (defun add-latest-path (pattern &optional all-paths)