Function: bovine-grammar-calculate-source-on-path

bovine-grammar-calculate-source-on-path is a byte-compiled function defined in grammar.el.gz.

Signature

(bovine-grammar-calculate-source-on-path)

Documentation

Calculate the location of the source for current buffer.

The source directory is relative to some root in the load path.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/grammar.el.gz
(defun bovine-grammar-calculate-source-on-path ()
  "Calculate the location of the source for current buffer.
The source directory is relative to some root in the load path."
  (condition-case nil
      (let* ((dir (nreverse (split-string (buffer-file-name) "/")))
	     (newdir (car dir)))
	(setq dir (cdr dir))
	;; Keep trying the file name until it is on the path.
	(while (and (not (locate-library newdir)) dir)
	  (setq newdir (concat (car dir) "/" newdir)
		dir (cdr dir)))
	(if (not dir)
	    (buffer-name)
	  newdir))
      (error (buffer-name))))