Function: vhdl-speedbar-expand-config

vhdl-speedbar-expand-config is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-speedbar-expand-config TEXT TOKEN INDENT)

Documentation

Expand/contract the configuration under the cursor.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-speedbar-expand-config (text token indent)
  "Expand/contract the configuration under the cursor."
  (cond
   ((string-match "\\+" text)		; expand configuration
    (let* ((key (vhdl-speedbar-line-key indent))
	   (conf-alist (vhdl-aget vhdl-config-alist key))
	   (conf-entry (vhdl-aget conf-alist token))
	   (ent-alist (vhdl-aget vhdl-entity-alist key))
	   (hier-alist (vhdl-get-hierarchy
			ent-alist conf-alist (nth 3 conf-entry)
			(nth 4 conf-entry) token (nth 5 conf-entry)
			0 indent t))
	   (subpack-alist (nth 6 conf-entry))
	   entry)
      (if (not (or hier-alist subpack-alist))
	  (speedbar-change-expand-button-char ??)
	(speedbar-change-expand-button-char ?-)
	;; add configuration to `vhdl-speedbar-shown-unit-alist'
	(let* ((unit-alist (vhdl-aget vhdl-speedbar-shown-unit-alist key)))
	  (vhdl-aput 'unit-alist token nil)
	  (vhdl-aput 'vhdl-speedbar-shown-unit-alist key unit-alist))
	(speedbar-with-writable
	 (save-excursion
	   (end-of-line) (forward-char 1)
	   ;; insert instance hierarchy
	   (when hier-alist
	     (vhdl-speedbar-make-title-line "Design hierarchy:" (1+ indent)))
	   (while hier-alist
	     (setq entry (car hier-alist))
	     (when (or (= vhdl-speedbar-hierarchy-depth 0)
		       (<= (nth 9 entry) vhdl-speedbar-hierarchy-depth))
	       (vhdl-speedbar-make-inst-line
		(nth 0 entry) (nth 1 entry) (nth 2 entry) (nth 3 entry)
		(nth 4 entry) (nth 5 entry) (nth 6 entry) (nth 7 entry)
		(nth 8 entry) (1+ indent) (nth 9 entry) ": "))
	     (setq hier-alist (cdr hier-alist)))
	   ;; insert required packages
	   (vhdl-speedbar-insert-subpackages
	    subpack-alist (1+ indent) indent)))
	(when (memq 'display vhdl-speedbar-save-cache)
	  (add-to-list 'vhdl-updated-project-list key))
	(vhdl-speedbar-update-current-unit t t))))
   ((string-match "-" text)		; contract configuration
    (speedbar-change-expand-button-char ?+)
    ;; remove configuration from `vhdl-speedbar-shown-unit-alist'
    (let* ((key (vhdl-speedbar-line-key indent))
	   (unit-alist (vhdl-aget vhdl-speedbar-shown-unit-alist key)))
      (vhdl-adelete 'unit-alist token)
      (if unit-alist
	  (vhdl-aput 'vhdl-speedbar-shown-unit-alist key unit-alist)
	(vhdl-adelete 'vhdl-speedbar-shown-unit-alist key))
      (speedbar-delete-subblock indent)
      (when (memq 'display vhdl-speedbar-save-cache)
	(add-to-list 'vhdl-updated-project-list key))))
   (t (error "Nothing to display")))
  (when (equal (selected-frame) speedbar-frame)
    (speedbar-center-buffer-smartly)))