aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-05 20:37:00 +0000
committerRichard M. Stallman1993-03-05 20:37:00 +0000
commitd76bfaa22c1383f8ad4bb0626b209540a08a3a7f (patch)
tree764a72007599b8a671fa9b8dca92e673955d57ae
parente2f4b44c398a4d6b577d6666a8ceea670881198c (diff)
downloademacs-d76bfaa22c1383f8ad4bb0626b209540a08a3a7f.tar.gz
emacs-d76bfaa22c1383f8ad4bb0626b209540a08a3a7f.zip
(compare-windows): Use compare-buffer-substrings.
-rw-r--r--lisp/compare-w.el15
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."
106 ;; Try advancing comparing 1000 chars at a time. 106 ;; Try advancing comparing 1000 chars at a time.
107 ;; When that fails, go 500 chars at a time, and so on. 107 ;; When that fails, go 500 chars at a time, and so on.
108 (let ((size 1000) 108 (let ((size 1000)
109 success-1) 109 success-1
110 (case-fold-search compare-ignore-case))
110 (while (> size 0) 111 (while (> size 0)
111 (setq success-1 t) 112 (setq success-1 t)
113 ;; Try comparing SIZE chars at a time, repeatedly, till that fails.
112 (while success-1 114 (while success-1
113 (setq size (min size (- maxp1 p1) (- maxp2 p2))) 115 (setq size (min size (- maxp1 p1) (- maxp2 p2)))
114 (save-excursion
115 (set-buffer b2)
116 (setq s2 (buffer-substring p2 (+ size p2))))
117 (setq success-1 116 (setq success-1
118 (and (> size 0) 117 (and (> size 0)
119 (if compare-ignore-case 118 (= 0 (compare-buffer-substrings b2 p2 (+ size p2)
120 (let ((case-fold-search t)) 119 b1 p1 (+ size p1)))))
121 (save-excursion
122 (search-forward s2 (+ p1 size) t)))
123 (equal (buffer-substring p1 (+ size p1)) s2))))
124 (if success-1 120 (if success-1
125 (setq p1 (+ p1 size) p2 (+ p2 size) 121 (setq p1 (+ p1 size) p2 (+ p2 size)
126 success t))) 122 success t)))
123 ;; If SIZE chars don't match, try fewer.
127 (setq size (/ size 2))))) 124 (setq size (/ size 2)))))
128 125
129 (goto-char p1) 126 (goto-char p1)