Function: vhdl-template-replace-header-keywords
vhdl-template-replace-header-keywords is a byte-compiled function
defined in vhdl-mode.el.gz.
Signature
(vhdl-template-replace-header-keywords BEG END &optional FILE-TITLE IS-MODEL)
Documentation
Replace keywords in header and footer.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-template-replace-header-keywords (beg end &optional file-title
is-model)
"Replace keywords in header and footer."
(let ((project-title (or (nth 0 (vhdl-aget vhdl-project-alist vhdl-project))
""))
(project-desc (or (nth 9 (vhdl-aget vhdl-project-alist vhdl-project))
""))
pos)
(vhdl-prepare-search-2
(save-excursion
(goto-char beg)
(while (search-forward "<projectdesc>" end t)
(replace-match project-desc t t))
(goto-char beg)
(while (search-forward "<filename>" end t)
(replace-match (buffer-name) t t))
(goto-char beg)
(while (search-forward "<copyright>" end t)
(replace-match vhdl-copyright-string t t))
(goto-char beg)
(while (search-forward "<author>" end t)
(replace-match "" t t)
(insert (user-full-name))
(when user-mail-address (insert " <" user-mail-address ">")))
(goto-char beg)
(while (search-forward "<authorfull>" end t)
(replace-match (user-full-name) t t))
(goto-char beg)
(while (search-forward "<login>" end t)
(replace-match (user-login-name) t t))
(goto-char beg)
(while (search-forward "<project>" end t)
(replace-match project-title t t))
(goto-char beg)
(while (search-forward "<company>" end t)
(replace-match vhdl-company-name t t))
(goto-char beg)
(while (search-forward "<platform>" end t)
(replace-match vhdl-platform-spec t t))
(goto-char beg)
(while (search-forward "<standard>" end t)
(replace-match
(concat "VHDL" (cond ((vhdl-standard-p '87) "'87")
((vhdl-standard-p '93) "'93/02")
((vhdl-standard-p '08) "'08"))
(when (vhdl-standard-p 'ams) ", VHDL-AMS")
(when (vhdl-standard-p 'math) ", Math Packages")) t t))
(goto-char beg)
;; Replace <RCS> with $, so that RCS for the source is
;; not over-enthusiastic with replacements
(while (search-forward "<RCS>" end t)
(replace-match "$" nil t))
(goto-char beg)
(while (search-forward "<date>" end t)
(replace-match "" t t)
(vhdl-template-insert-date))
(goto-char beg)
(let ((year (format-time-string "%Y")))
(while (search-forward "<year>" end t)
(replace-match year t t)))
(goto-char beg)
(when file-title
(while (search-forward "<title string>" end t)
(replace-match file-title t t))
(goto-char beg))
(let (string)
(while (re-search-forward "<\\(\\(\\w\\|\\s_\\)*\\) string>" end t)
(save-match-data
(setq string (read-string (concat (match-string 1) ": "))))
(replace-match string t t)))
(goto-char beg)
(when (and (not is-model) (search-forward "<cursor>" end t))
(replace-match "" t t)
(setq pos (point))))
(when pos (goto-char pos))
(unless is-model
(when (or (not project-title) (equal project-title ""))
(message "You can specify a project title in user option `vhdl-project-alist'"))
(when (or (not project-desc) (equal project-desc ""))
(message "You can specify a project description in user option `vhdl-project-alist'"))
(when (equal vhdl-platform-spec "")
(message "You can specify a platform in user option `vhdl-platform-spec'"))
(when (equal vhdl-company-name "")
(message "You can specify a company name in user option `vhdl-company-name'"))))))