Function: verilog-diff-buffers-p
verilog-diff-buffers-p is a byte-compiled function defined in
verilog-mode.el.gz.
Signature
(verilog-diff-buffers-p B1 B2 &optional WHITESPACE REGEXP)
Documentation
Return nil if buffers B1 and B2 have same contents.
Else, return point in B1 that first mismatches. If optional WHITESPACE true, ignore whitespace. If optional REGEXP, ignore differences matching it.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
;;
;; Auto diff:
;;
(defun verilog-diff-buffers-p (b1 b2 &optional whitespace regexp)
"Return nil if buffers B1 and B2 have same contents.
Else, return point in B1 that first mismatches.
If optional WHITESPACE true, ignore whitespace.
If optional REGEXP, ignore differences matching it."
(save-excursion
(let* ((case-fold-search nil) ; compare-buffer-substrings cares
(p1 (with-current-buffer b1 (goto-char (point-min))))
(p2 (with-current-buffer b2 (goto-char (point-min))))
(maxp1 (with-current-buffer b1 (point-max)))
(maxp2 (with-current-buffer b2 (point-max)))
(op1 -1) (op2 -1)
progress size)
(while (not (and (eq p1 op1) (eq p2 op2)))
;; If both windows have whitespace optionally skip over it.
(when whitespace
;; skip-syntax-* doesn't count \n
(with-current-buffer b1
(goto-char p1)
(skip-chars-forward " \t\n\r\f\v")
(setq p1 (point)))
(with-current-buffer b2
(goto-char p2)
(skip-chars-forward " \t\n\r\f\v")
(setq p2 (point))))
(when regexp
(with-current-buffer b1
(goto-char p1)
(when (looking-at regexp)
(setq p1 (match-end 0))))
(with-current-buffer b2
(goto-char p2)
(when (looking-at regexp)
(setq p2 (match-end 0)))))
(setq size (min (- maxp1 p1) (- maxp2 p2)))
(setq progress (compare-buffer-substrings b2 p2 (+ size p2)
b1 p1 (+ size p1)))
(setq progress (if (zerop progress) size (1- (abs progress))))
(setq op1 p1 op2 p2
p1 (+ p1 progress)
p2 (+ p2 progress)))
;; Return value
(if (and (eq p1 maxp1) (eq p2 maxp2))
nil p1))))