Function: speedbar-files-line-directory

speedbar-files-line-directory is a byte-compiled function defined in speedbar.el.gz.

Signature

(speedbar-files-line-directory &optional DEPTH)

Documentation

Retrieve the directory associated with the current line.

This may require traversing backwards from DEPTH and combining the default directory with these items.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-files-line-directory (&optional depth)
  "Retrieve the directory associated with the current line.
This may require traversing backwards from DEPTH and combining the default
directory with these items."
  (save-excursion
    (save-match-data
      (if (not depth)
	  (progn
	    (beginning-of-line)
	    (looking-at "^\\([0-9]+\\):")
	    (setq depth (string-to-number (match-string 1)))))
      (let ((directory nil))
	(setq depth (1- depth))
	(while (/= depth -1)
	  (if (not (re-search-backward (format "^%d:" depth) nil t))
	      (error "Error building filename of tag")
	    (cond ((looking-at "[0-9]+:\\s-*<->\\s-+\\([^\n]+\\)")
		   (setq directory (concat (speedbar-line-text)
				      "/"
				      directory)))
		  ((looking-at "[0-9]+:\\s-*[-]\\s-+\\([^\n]+\\)")
		   ;; This is the start of our directory.
		   (setq directory (speedbar-line-text)))))
	  (setq depth (1- depth)))
	(if (and directory
		 (string-match (concat speedbar-indicator-regex "$")
			       directory))
	    (setq directory (substring directory 0 (match-beginning 0))))
	(concat default-directory directory)))))