Function: verilog-string-replace-matches

verilog-string-replace-matches is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-string-replace-matches FROM-STRING TO-STRING FIXEDCASE LITERAL STRING)

Documentation

Replace occurrences of FROM-STRING with TO-STRING.

FIXEDCASE and LITERAL as in replace-match. STRING is what to replace. The case (verilog-string-replace-matches "o" "oo" nil nil "foobar") will break, as the o's continuously replace. xa -> x works ok though.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defsubst verilog-string-replace-matches (from-string to-string fixedcase literal string)
  "Replace occurrences of FROM-STRING with TO-STRING.
FIXEDCASE and LITERAL as in `replace-match'.  STRING is what to replace.
The case (verilog-string-replace-matches \"o\" \"oo\" nil nil \"foobar\")
will break, as the o's continuously replace.  xa -> x works ok though."
  ;; Hopefully soon to an Emacs built-in
  ;; Also note \ in the replacement prevent multiple replacements; IE
  ;;   (verilog-string-replace-matches "@" "\\\\([0-9]+\\\\)" nil nil "wire@_@")
  ;;   Gives "wire\([0-9]+\)_@" not "wire\([0-9]+\)_\([0-9]+\)"
  (let ((start 0))
    (while (string-match from-string string start)
      (setq string (replace-match to-string fixedcase literal string)
	    start (min (length string) (+ (match-beginning 0) (length to-string)))))
    string))