Function: verilog-read-auto-template

verilog-read-auto-template is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-read-auto-template MODULE)

Documentation

Look for an auto_template for the instantiation of the given MODULE.

If found returns verilog-read-auto-template-middle structure.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-read-auto-template (module)
  "Look for an auto_template for the instantiation of the given MODULE.
If found returns `verilog-read-auto-template-middle' structure."
  (save-excursion
    ;; Find beginning
    (let ((pt (point)))
      ;; Note this search is expensive, as we hunt from mod-begin to point
      ;; for every instantiation.  Likewise in verilog-read-auto-lisp.
      ;; So, we look first for an exact string rather than a slow regexp.
      ;; Someday we may keep a cache of every template, but this would also
      ;; need to record the relative position of each AUTOINST, as multiple
      ;; templates exist for each module, and we're inserting lines.
      (cond ((or
	      ;; See also regexp in `verilog-auto-template-lint'
	      (verilog-re-search-backward-substr
	       "AUTO_TEMPLATE"
	       (concat "^\\s-*/?\\*?\\s-*" module "\\s-+AUTO_TEMPLATE") nil t)
	      ;; Also try forward of this AUTOINST
	      ;; This is for historical support; this isn't speced as working
	      (progn
		(goto-char pt)
		(verilog-re-search-forward-substr
		 "AUTO_TEMPLATE"
		 (concat "^\\s-*/?\\*?\\s-*" module "\\s-+AUTO_TEMPLATE") nil t)))
	     (goto-char (match-end 0))
	     (verilog-read-auto-template-middle))
	    ;; If no template found
	    (t (vector "" nil))))))