Function: ede-buffer-object

ede-buffer-object is a byte-compiled function defined in ede.el.gz.

Signature

(ede-buffer-object &optional BUFFER PROJSYM)

Documentation

Return the target object for BUFFER.

This function clears cached values and recalculates. Optional PROJSYM is a symbol, which will be set to the project that contains the target that becomes buffer's object.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede.el.gz
(defun ede-buffer-object (&optional buffer projsym)
  "Return the target object for BUFFER.
This function clears cached values and recalculates.
Optional PROJSYM is a symbol, which will be set to the project
that contains the target that becomes buffer's object."
  (save-excursion
    (if (not buffer) (setq buffer (current-buffer)))
    (set-buffer buffer)
    (setq ede-object nil)
    (let* ((localpo (ede-current-project))
	   (po localpo)
	   (top (ede-toplevel po)))
      (if po (setq ede-object (ede-find-target po buffer)))
      ;; If we get nothing, go with the backup plan of slowly
      ;; looping upward
      (while (and (not ede-object) (not (eq po top)))
	(setq po (ede-parent-project po))
	(if po (setq ede-object (ede-find-target po buffer))))
      ;; Filter down to 1 project if there are dups.
      (if (= (length ede-object) 1)
	  (setq ede-object (car ede-object)))
      ;; Track the project, if needed.
      (when (and projsym (symbolp projsym))
	(if ede-object
	    ;; If we found a target, then PO is the
	    ;; project to use.
	    (set projsym po)
	  ;; If there is no ede-object, then the projsym
	  ;; is whichever part of the project is most local.
	  (set projsym localpo))
	))
    ;; Return our findings.
    ede-object))