Function: ede-initialize-state-current-buffer
ede-initialize-state-current-buffer is a byte-compiled function
defined in ede.el.gz.
Signature
(ede-initialize-state-current-buffer)
Documentation
Initialize the current buffer's state for EDE.
Sets buffer local variables for EDE.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/ede.el.gz
(defun ede-initialize-state-current-buffer ()
"Initialize the current buffer's state for EDE.
Sets buffer local variables for EDE."
;; due to inode recycling, make sure we don't
;; we flush projects deleted off the system.
(ede-flush-deleted-projects)
;; Init the buffer.
(let* ((ROOT nil)
(proj (ede-directory-get-open-project default-directory
(gv-ref ROOT))))
(when (not proj)
;; If there is no open project, look up the project
;; autoloader to see if we should initialize.
(let ((projdetect (ede-directory-project-cons default-directory)))
(when projdetect
;; No project was loaded, but we have a project description
;; object. This means that we try to load it.
;;
;; Before loading, we need to check if it is a safe
;; project to load before requesting it to be loaded.
(when (or (oref (cdr projdetect) safe-p)
;; The project style is not safe, so check if it is
;; in `ede-project-directories'.
(let ((top (car projdetect)))
(ede-directory-safe-p top)))
;; The project is safe, so load it in.
(setq proj (ede-load-project-file default-directory projdetect
(gv-ref ROOT)))))))
;; If PROJ is now loaded in, we can initialize our buffer to it.
(when proj
;; ede-object represents the specific EDE related class that best
;; represents this buffer. It could be a project (for a project file)
;; or a target. Also save off ede-object-project, the project that
;; the buffer belongs to for the case where ede-object is a target.
(setq ede-object (ede-buffer-object (current-buffer)
'ede-object-project))
;; Every project has a root. It might be the same as ede-object.
;; Cache that also as the root is a very common thing to need.
(setq ede-object-root-project
(or ROOT (ede-project-root ede-object-project)))
;; Check to see if we want to add this buffer to a target.
(if (and (not ede-object) ede-object-project)
(ede-auto-add-to-target))
;; Apply any options from the found target.
(ede-apply-target-options))))