Function: vhdl-template-package
vhdl-template-package is an interactive and byte-compiled function
defined in vhdl-mode.el.gz.
Signature
(vhdl-template-package &optional KIND)
Documentation
Insert a package specification or body.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-template-package (&optional kind)
"Insert a package specification or body."
(interactive)
(let ((margin (current-indentation))
(start (point))
name body position)
(vhdl-insert-keyword "PACKAGE ")
(setq body (if kind (eq kind 'body)
(eq (vhdl-decision-query nil "(d)eclaration or (b)ody?") ?b)))
(when body
(vhdl-insert-keyword "BODY ")
(when (save-excursion
(vhdl-prepare-search-1
(vhdl-re-search-backward "\\<package \\(\\w+\\) is\\>" nil t)))
(insert (setq name (match-string 1)))))
(when (or name
(setq name (vhdl-template-field "name" nil t start (point))))
(vhdl-insert-keyword " IS\n")
(when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
(indent-to (+ margin vhdl-basic-offset))
(setq position (point))
(insert "\n")
(when (memq vhdl-insert-empty-lines '(unit all)) (insert "\n"))
(indent-to margin)
(vhdl-insert-keyword "END ")
(unless (vhdl-standard-p '87)
(vhdl-insert-keyword (concat "PACKAGE " (and body "BODY "))))
(insert (or name "") ";")
(goto-char position))))