Function: vhdl-speedbar-update-current-unit
vhdl-speedbar-update-current-unit is a byte-compiled function defined
in vhdl-mode.el.gz.
Signature
(vhdl-speedbar-update-current-unit &optional NO-POSITION ALWAYS)
Documentation
Highlight all design units that are contained in the current file.
NO-POSITION non-nil means do not re-position cursor.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-speedbar-update-current-unit (&optional no-position always)
"Highlight all design units that are contained in the current file.
NO-POSITION non-nil means do not re-position cursor."
(let ((last-frame (selected-frame))
(project-list vhdl-speedbar-shown-project-list)
file-alist pos file-name)
;; get current file name
(if (fboundp 'speedbar-select-attached-frame)
(speedbar-select-attached-frame)
(select-frame speedbar-attached-frame))
(setq file-name (abbreviate-file-name (or (buffer-file-name) "")))
(when (and vhdl-speedbar-update-current-unit
(or always (not (equal file-name speedbar-last-selected-file))))
(if vhdl-speedbar-show-projects
(while project-list
(setq file-alist (append file-alist
(vhdl-aget vhdl-file-alist
(car project-list))))
(setq project-list (cdr project-list)))
(setq file-alist
(vhdl-aget vhdl-file-alist
(abbreviate-file-name default-directory))))
(select-frame speedbar-frame)
(set-buffer speedbar-buffer)
(speedbar-with-writable
(vhdl-prepare-search-1
(save-excursion
;; unhighlight last units
(let* ((file-entry (vhdl-aget file-alist
speedbar-last-selected-file)))
(vhdl-speedbar-update-units
"\\[.] " (nth 0 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-entity-face)
(vhdl-speedbar-update-units
"{.} " (nth 1 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-architecture-face)
(vhdl-speedbar-update-units
"\\[.] " (nth 3 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-configuration-face)
(vhdl-speedbar-update-units
"[]>] " (nth 4 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-package-face)
(vhdl-speedbar-update-units
"\\[.].+(" '("body")
speedbar-last-selected-file 'vhdl-speedbar-package-face)
(vhdl-speedbar-update-units
"> " (nth 6 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-instantiation-face))
;; highlight current units
(let* ((file-entry (vhdl-aget file-alist file-name)))
(setq
pos (vhdl-speedbar-update-units
"\\[.] " (nth 0 file-entry)
file-name 'vhdl-speedbar-entity-selected-face pos)
pos (vhdl-speedbar-update-units
"{.} " (nth 1 file-entry)
file-name 'vhdl-speedbar-architecture-selected-face pos)
pos (vhdl-speedbar-update-units
"\\[.] " (nth 3 file-entry)
file-name 'vhdl-speedbar-configuration-selected-face pos)
pos (vhdl-speedbar-update-units
"[]>] " (nth 4 file-entry)
file-name 'vhdl-speedbar-package-selected-face pos)
pos (vhdl-speedbar-update-units
"\\[.].+(" '("body")
file-name 'vhdl-speedbar-package-selected-face pos)
pos (vhdl-speedbar-update-units
"> " (nth 6 file-entry)
file-name 'vhdl-speedbar-instantiation-selected-face pos))))))
;; move speedbar so the first highlighted unit is visible
(when (and pos (not no-position))
(goto-char pos)
(speedbar-center-buffer-smartly)
(speedbar-position-cursor-on-line))
(setq speedbar-last-selected-file file-name))
(select-frame last-frame)
t))