Function: verilog-comment-region

verilog-comment-region is an interactive and byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-comment-region START END)

Documentation

Put the region into a Verilog comment.

The comments that are in this area are "deformed":
*) becomes !(* and } becomes !{.
These deformed comments are returned to normal if you use M-x verilog-uncomment-region (verilog-uncomment-region) to undo the commenting.

The commented area starts with verilog-exclude-str-start, and ends with verilog-exclude-str-end. But if you change these variables, M-x verilog-uncomment-region (verilog-uncomment-region) won't recognize the comments.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-comment-region (start end)
  ;; checkdoc-params: (start end)
  "Put the region into a Verilog comment.
The comments that are in this area are \"deformed\":
`*)' becomes `!(*' and `}' becomes `!{'.
These deformed comments are returned to normal if you use
\\[verilog-uncomment-region] to undo the commenting.

The commented area starts with `verilog-exclude-str-start', and ends with
`verilog-exclude-str-end'.  But if you change these variables,
\\[verilog-uncomment-region] won't recognize the comments."
  (interactive "r")
  (save-excursion
    ;; Insert start and endcomments
    (goto-char end)
    (if (and (save-excursion (skip-chars-forward " \t") (eolp))
	     (not (save-excursion (skip-chars-backward " \t") (bolp))))
	(forward-line 1)
      (beginning-of-line))
    (insert verilog-exclude-str-end)
    (setq end (point))
    (newline)
    (goto-char start)
    (beginning-of-line)
    (insert verilog-exclude-str-start)
    (newline)
    ;; Replace end-comments within commented area
    (goto-char end)
    (save-excursion
      (while (re-search-backward "\\*/" start t)
	(replace-match "*-/" t t)))
    (save-excursion
      (let ((s+1 (1+ start)))
	(while (re-search-backward "/\\*" s+1 t)
	  (replace-match "/-*" t t))))))