Function: ede-toplevel-project

ede-toplevel-project is a byte-compiled function defined in files.el.gz.

Signature

(ede-toplevel-project DIR)

Documentation

Starting with DIR, find the toplevel project directory.

If DIR is not part of a project, return nil.

Aliases

ede-toplevel-project-or-nil (obsolete since 29.1)

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede/files.el.gz
;;; TOPLEVEL
;;
;; These utilities will identify the "toplevel" of a project.
;;
;; NOTE: This -toplevel- function returns a directory even though
;;       the function name implies a project.

(defun ede-toplevel-project (dir)
  "Starting with DIR, find the toplevel project directory.
If DIR is not part of a project, return nil."
  (let ((ans nil))

    (cond
     ;; Check if it is cached in the current buffer.
     ((and (string= dir default-directory)
	   ede-object-root-project)
      ;; Try the local buffer cache first.
      (oref ede-object-root-project directory))

     ;; See if there is an existing project in DIR.
     ((setq ans (ede-directory-get-toplevel-open-project dir))
      (oref ans directory))

     ;; Detect using our file system detector.
     ((setq ans (ede-detect-directory-for-project dir))
      (car ans))

     (t nil))))