Function: speedbar-directory-line

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

Signature

(speedbar-directory-line DIRECTORY)

Documentation

Position the cursor on the line specified by DIRECTORY.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-directory-line (directory)
  "Position the cursor on the line specified by DIRECTORY."
  (save-match-data
    (if (string-match "[/\\]$" directory)
	(setq directory (substring directory 0 (match-beginning 0))))
    (let ((nomatch t) (depth 0)
	  (fname (file-name-nondirectory directory))
	  (pname (file-name-directory directory)))
      (if (not (member pname speedbar-shown-directories))
	  (error "Internal Error: File %s not shown in speedbar" directory))
      (goto-char (point-min))
      (while (and nomatch
		  (re-search-forward
		   (concat "[]>] \\(" (regexp-quote fname)
			   "\\)\\(" speedbar-indicator-regex "\\)?$")
		   nil t))
	(beginning-of-line)
	(looking-at "\\([0-9]+\\):")
	(setq depth (string-to-number (match-string 0))
	      nomatch (not (string= pname (speedbar-line-directory depth))))
	(end-of-line))
      (beginning-of-line)
      (not nomatch))))