Function: verilog-re-search-backward-substr

verilog-re-search-backward-substr is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-re-search-backward-substr SUBSTR REGEXP BOUND NOERROR)

Documentation

Like re-search-backward, but first search for SUBSTR constant.

Then searched for the normal REGEXP (which contains SUBSTR), with given BOUND and NOERROR. The REGEXP must fit within a single line. This speeds up complicated regexp matches.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
;;(verilog-re-search-forward-substr "-end" "get-end-of" nil t)  ; -end (test bait)

(defsubst verilog-re-search-backward-substr (substr regexp bound noerror)
  "Like `re-search-backward', but first search for SUBSTR constant.
Then searched for the normal REGEXP (which contains SUBSTR), with given
BOUND and NOERROR.  The REGEXP must fit within a single line.
This speeds up complicated regexp matches."
  ;; Problem with overlap: search-backward BAR then FOOBARBAZ won't match.
  ;; thus require matches to be on one line, and use beginning-of-line.
  (let (done)
    (while (and (not done)
		(search-backward substr bound noerror))
      (save-excursion
	(end-of-line)
	(setq done (re-search-backward regexp (point-at-bol) noerror)))
      (unless (and (<= (match-beginning 0) (point))
		   (>= (match-end 0) (point)))
	(setq done nil)))
    (when done (goto-char done))
    done))