Function: speedbar-update-current-file
speedbar-update-current-file is a byte-compiled function defined in
speedbar.el.gz.
Signature
(speedbar-update-current-file)
Documentation
Find the current file, and update our visuals to indicate its name.
This is specific to file names. If the file name doesn't show up, but it should be in the list, then the directory cache needs to be updated.
Source Code
;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-update-current-file ()
"Find the current file, and update our visuals to indicate its name.
This is specific to file names. If the file name doesn't show up, but
it should be in the list, then the directory cache needs to be updated."
(let* ((lastf (selected-frame))
(newcfd (save-excursion
(dframe-select-attached-frame speedbar-frame)
(let ((rf (if (buffer-file-name)
(buffer-file-name)
nil)))
(select-frame lastf)
rf)))
(newcf (if newcfd newcfd))
(lastb (current-buffer))
(sucf-recursive (boundp 'sucf-recursive))
(case-fold-search t))
(if (and newcf
;; check here, that way we won't refresh to newcf until
;; its been written, thus saving ourselves some time
(file-exists-p newcf)
(not (string= newcf speedbar-last-selected-file)))
(progn
;; It is important to select the frame, otherwise the window
;; we want the cursor to move in will not be updated by the
;; search-forward command.
(select-frame (speedbar-current-frame))
;; Remove the old file...
(speedbar-clear-current-file)
;; now highlight the new one.
;; (set-buffer speedbar-buffer)
(speedbar-with-writable
(if (speedbar-find-selected-file newcf)
;; put the property on it
(put-text-property (match-beginning 1)
(match-end 1)
'face
'speedbar-selected-face)
;; Oops, it's not in the list. Should it be?
(if (and (string-match speedbar-file-regexp newcf)
(string= (file-name-directory newcfd)
(expand-file-name default-directory)))
;; yes, it is (we will ignore unknowns for now...)
(progn
(speedbar-refresh)
(if (speedbar-find-selected-file newcf)
;; put the property on it
(put-text-property (match-beginning 1)
(match-end 1)
'face
'speedbar-selected-face)))
;; if it's not in there now, whatever...
))
(setq speedbar-last-selected-file newcf))
(if (not sucf-recursive)
(progn
;;Sat Dec 15 2001 12:40 AM (burton@openprivacy.org): this
;;doesn't need to be in. We don't want to recenter when we are
;;updating files.
;;(speedbar-center-buffer-smartly)
(speedbar-position-cursor-on-line)
))
(set-buffer lastb)
(select-frame lastf)
)))
;; return that we are done with this activity.
t)