Function: ede-directory-get-open-project

ede-directory-get-open-project is a byte-compiled function defined in files.el.gz.

Signature

(ede-directory-get-open-project DIR &optional ROOTRETURN)

Documentation

Return an already open project that is managing DIR.

Optional ROOTRETURN specifies a gv-ref to set to the root project. If DIR is the root project, then it is the same.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede/files.el.gz
;;; DIRECTORY IN OPEN PROJECT
;;
;; These routines match some directory name to one of the many pre-existing
;; open projects.  This should avoid hitting the disk, or asking lots of questions
;; if used throughout the other routines.

(defun ede-directory-get-open-project (dir &optional rootreturn)
  "Return an already open project that is managing DIR.
Optional ROOTRETURN specifies a `gv-ref' to set to the root project.
If DIR is the root project, then it is the same."
  (let* ((inode (ede--inode-for-dir dir))
	 (ft (file-name-as-directory (expand-file-name dir)))
	 (proj (ede--inode-get-toplevel-open-project inode))
	 (ans nil))
    ;; Try file based search.
    (when (or ede--disable-inode (not proj))
      (setq proj (ede-directory-get-toplevel-open-project ft)))
    ;; Default answer is this project
    (setq ans proj)
    ;; Save.
    (when rootreturn (if (symbolp rootreturn) (set rootreturn proj)
                       (setf (gv-deref rootreturn) proj)))
    ;; Find subprojects.
    (when (and proj (if ede--disable-inode
			(not (string= ft (expand-file-name
                                          (oref proj directory))))
		      (not (equal inode (ede--project-inode proj)))))
      (setq ans (ede-find-subproject-for-directory proj ft)))
    ans))