diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-03-05 20:37:00 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-03-05 20:37:00 +0000 |
commit | 4c87909dbaa9d92ccd584ac65d3e9bee15a3477a (patch) | |
tree | 3fdfab2f061c3f7b8b056367a7551d50f78e70a1 /lisp/compare-w.el | |
parent | b4ff1d81b232abc5ebe2a2135e9a244c5cd4f3c4 (diff) | |
download | emacs-4c87909dbaa9d92ccd584ac65d3e9bee15a3477a.tar.gz |
(compare-windows): Use compare-buffer-substrings.
Diffstat (limited to 'lisp/compare-w.el')
-rw-r--r-- | lisp/compare-w.el | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lisp/compare-w.el b/lisp/compare-w.el index 13b7d4d1794..d4d6a4d746e 100644 --- a/lisp/compare-w.el +++ b/lisp/compare-w.el @@ -106,24 +106,21 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored." ;; Try advancing comparing 1000 chars at a time. ;; When that fails, go 500 chars at a time, and so on. (let ((size 1000) - success-1) + success-1 + (case-fold-search compare-ignore-case)) (while (> size 0) (setq success-1 t) + ;; Try comparing SIZE chars at a time, repeatedly, till that fails. (while success-1 (setq size (min size (- maxp1 p1) (- maxp2 p2))) - (save-excursion - (set-buffer b2) - (setq s2 (buffer-substring p2 (+ size p2)))) (setq success-1 (and (> size 0) - (if compare-ignore-case - (let ((case-fold-search t)) - (save-excursion - (search-forward s2 (+ p1 size) t))) - (equal (buffer-substring p1 (+ size p1)) s2)))) + (= 0 (compare-buffer-substrings b2 p2 (+ size p2) + b1 p1 (+ size p1))))) (if success-1 (setq p1 (+ p1 size) p2 (+ p2 size) success t))) + ;; If SIZE chars don't match, try fewer. (setq size (/ size 2))))) (goto-char p1) |