Function: vhdl-port-paste-constants

vhdl-port-paste-constants is an interactive and byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-port-paste-constants &optional NO-INDENT)

Documentation

Paste generics as constants.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-port-paste-constants (&optional no-indent)
  "Paste generics as constants."
  (interactive)
  (if (not vhdl-port-list)
      (error "ERROR:  No port read")
    (let ((orig-vhdl-port-list vhdl-port-list))
      (message "Pasting port as constants...")
      ;; flatten local copy of port list (must be flat for constant initial.)
      (vhdl-port-flatten)
      (unless no-indent (indent-according-to-mode))
      (let ((margin (current-indentation))
	    start generic name
	    (generic-list (nth 1 vhdl-port-list)))
	(when generic-list
	  (setq start (point))
	  (while generic-list
	    (setq generic (car generic-list))
	    ;; paste group comment and spacing
	    (when (memq vhdl-include-group-comments '(decl always))
	      (vhdl-paste-group-comment (nth 4 generic) margin))
	    (vhdl-insert-keyword "CONSTANT ")
	    ;; paste generic constants
	    (setq name (nth 0 generic))
	    (when name
	      (insert (vhdl-replace-string vhdl-actual-generic-name (car name)))
	      ;; paste type
	      (insert " : " (nth 1 generic))
	      ;; paste initialization
	      (when (nth 2 generic)
		(insert " := " (nth 2 generic)))
	      (insert ";")
	      ;; paste comment
	      (when (and vhdl-include-port-comments (nth 3 generic))
		(vhdl-comment-insert-inline (nth 3 generic) t))
	      (setq generic-list (cdr generic-list))
	      (when generic-list (insert "\n") (indent-to margin))))
	    ;; align signal list
	  (when vhdl-auto-align
	    (vhdl-align-region-groups start (point) 1))))
      (message "Pasting port as constants...done")
      (setq vhdl-port-list orig-vhdl-port-list))))