Function: vhdl-template-field

vhdl-template-field is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-template-field PROMPT &optional FOLLOW-STRING OPTIONAL BEGIN END IS-STRING DEFAULT)

Documentation

Prompt for string and insert it in buffer with optional FOLLOW-STRING.

If OPTIONAL is nil, the prompt is left if an empty string is inserted. If an empty string is inserted, return nil and call vhdl-template-undo for the region between BEGIN and END. IS-STRING indicates whether a string with double-quotes is to be inserted. DEFAULT specifies a default string.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-template-field (prompt &optional follow-string optional
				   begin end is-string default)
  "Prompt for string and insert it in buffer with optional FOLLOW-STRING.
If OPTIONAL is nil, the prompt is left if an empty string is inserted.  If
an empty string is inserted, return nil and call `vhdl-template-undo' for
the region between BEGIN and END.  IS-STRING indicates whether a string
with double-quotes is to be inserted.  DEFAULT specifies a default string."
  (let ((position (point))
	string)
    (insert "<" prompt ">")
    (setq string
	  (condition-case ()
	      (read-from-minibuffer (concat prompt ": ")
				    (or (and is-string '("\"\"" . 2)) default)
				    vhdl-minibuffer-local-map)
	    (quit (if (and optional begin end)
		      (progn (beep) "")
		    (keyboard-quit)))))
    (when (or (not (equal string "")) optional)
      (delete-region position (point)))
    (when (and (equal string "") optional begin end)
      (vhdl-template-undo begin end)
      (message "Template aborted"))
    (unless (equal string "")
      (insert string)
      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-keywords
			      vhdl-keywords-regexp)
      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-types
			      vhdl-types-regexp)
      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-attributes
			      (concat "'" vhdl-attributes-regexp))
      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-enum-values
			      vhdl-enum-values-regexp)
      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-constants
			      vhdl-constants-regexp))
    (when (or (not (equal string "")) (not optional))
      (insert (or follow-string "")))
    (if (equal string "") nil string)))