Function: ede-load-project-file

ede-load-project-file is a byte-compiled function defined in ede.el.gz.

Signature

(ede-load-project-file DIR &optional DETECTIN ROOTRETURN)

Documentation

Project file independent way to read a project in from DIR.

Optional DETECTIN is an autoload cons from ede-detect-directory-for-project which can be passed in to save time. Optional ROOTRETURN reference will return the root project for DIR.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede.el.gz
(defun ede-load-project-file (dir &optional detectin rootreturn)
  "Project file independent way to read a project in from DIR.
Optional DETECTIN is an autoload cons from `ede-detect-directory-for-project'
which can be passed in to save time.
Optional ROOTRETURN reference will return the root project for DIR."
  ;; Don't do anything if we are in the process of
  ;; constructing an EDE object.
  ;;
  ;; Prevent recursion.
  (unless ede-constructing

    ;; Only load if something new is going on.  Flush the dirhash.
    (ede-project-directory-remove-hash dir)

    ;; Do the load
    ;;(message "EDE LOAD : %S" file)
    (let* ((path (file-name-as-directory (expand-file-name dir)))
	   (detect (or detectin (ede-directory-project-cons path)))
	   (autoloader nil)
	   (toppath nil)
	   (o nil))

      (when detect
	(setq toppath (car detect))
	(setq autoloader (cdr detect))

	;; See if it's been loaded before.  Use exact matching since
	;; know that 'toppath' is the root of the project.
	(setq o (ede-directory-get-toplevel-open-project toppath 'exact))

	;; If not open yet, load it.
	(unless o
	  ;; NOTE: We set ede-constructing to the autoloader we are using.
	  ;;       Some project types have one class, but many autoloaders
	  ;;       and this is how we tell the instantiation which kind of
	  ;;       project to make.
	  (let ((ede-constructing autoloader))

	    ;; This is the only place `ede-auto-load-project' should be called.

	    (setq o (ede-auto-load-project autoloader toppath))))

	;; Return the found root project.
	(when rootreturn (if (symbolp rootreturn) (set rootreturn o)
                           (setf (gv-deref rootreturn) o)))

	;; The project has been found (in the global list) or loaded from
	;; disk (via autoloader.)  We can now search for the project asked
	;; for from DIR in the sub-list.
	(ede-find-subproject-for-directory o path)

	;; Return the project.
	o))))