Function: inversion-add-to-load-path

inversion-add-to-load-path is a byte-compiled function defined in inversion.el.gz.

Signature

(inversion-add-to-load-path PACKAGE MINIMUM &optional INSTALLDIR &rest SUBDIRS)

Documentation

Add the PACKAGE path to load-path if necessary.

MINIMUM is the minimum version requirement of PACKAGE. Optional argument INSTALLDIR is the base directory where PACKAGE is installed. It defaults to default-directory/PACKAGE. SUBDIRS are sub-directories to add to load-path, following the main INSTALLDIR path.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/inversion.el.gz
(defun inversion-add-to-load-path (package minimum
					   &optional installdir
					   &rest subdirs)
  "Add the PACKAGE path to `load-path' if necessary.
MINIMUM is the minimum version requirement of PACKAGE.
Optional argument INSTALLDIR is the base directory where PACKAGE is
installed.  It defaults to `default-directory'/PACKAGE.
SUBDIRS are sub-directories to add to `load-path', following the main
INSTALLDIR path."
  (let ((ver (inversion-find-version package)))
    ;; If PACKAGE not found or a bad version already in `load-path',
    ;; prepend the new PACKAGE path, so it will be loaded first.
    (when (or (not ver)
              (and
               (inversion-check-version (car ver) (cdr ver) minimum)
               (message "Outdated %s %s shadowed to meet minimum version %s"
                        package (car ver) minimum)
               t))
      (let* ((default-directory
               (or installdir
                   (expand-file-name (format "./%s" package))))
             subdir)
        (when (file-directory-p default-directory)
          ;; Add SUBDIRS
          (while subdirs
            (setq subdir  (expand-file-name (car subdirs))
                  subdirs (cdr subdirs))
            (when (file-directory-p subdir)
              ;;(message "%S added to `load-path'" subdir)
              (add-to-list 'load-path subdir)))
          ;; Add the main path
          ;;(message "%S added to `load-path'" default-directory)
          (add-to-list 'load-path default-directory))
	;; We get to this point iff we do not accept or there is no
	;; system file.  Let's check the version of what we just
	;; installed... just to be safe.
	(let ((newver (inversion-find-version package)))
	  (if (not newver)
	      (error "Failed to find version for newly installed %s"
		     package))
	  (if (inversion-check-version (car newver) (cdr newver) minimum)
	      (error "Outdated %s %s just installed" package (car newver)))
	  )))))