aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/compare-w.el22
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/compare-w.el b/lisp/compare-w.el
index a52e8e07541..a6bd00e1a07 100644
--- a/lisp/compare-w.el
+++ b/lisp/compare-w.el
@@ -134,19 +134,29 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored."
134;; and find the latest point at which a match ends. 134;; and find the latest point at which a match ends.
135;; Don't try starting points before START, though. 135;; Don't try starting points before START, though.
136;; Value is non-nil if whitespace is found. 136;; Value is non-nil if whitespace is found.
137
138;; If there is whitespace before point, but none after,
139;; then return t, but don't advance point.
137(defun compare-windows-skip-whitespace (start) 140(defun compare-windows-skip-whitespace (start)
138 (let ((end (point)) 141 (let ((end (point))
142 (beg (point))
139 (opoint (point))) 143 (opoint (point)))
140 (while (and (looking-at compare-windows-whitespace) 144 (while (or (and (/= (point) start)
141 (<= end (match-end 0)) 145 ;; Consider at least the char before point,
142 ;; This match goes past END, so advance END. 146 ;; unless it is also before START.
143 (progn (setq end (match-end 0)) 147 (= (point) opoint))
144 (> (point) start))) 148 (and (looking-at compare-windows-whitespace)
149 (<= end (match-end 0))
150 ;; This match goes past END, so advance END.
151 (progn (setq end (match-end 0))
152 (> (point) start))))
145 ;; keep going back until whitespace 153 ;; keep going back until whitespace
146 ;; doesn't extend to or past end 154 ;; doesn't extend to or past end
147 (forward-char -1)) 155 (forward-char -1))
156 (setq beg (point))
148 (goto-char end) 157 (goto-char end)
149 (/= end opoint))) 158 (or (/= beg opoint)
159 (/= end opoint))))
150 160
151(provide 'compare-w) 161(provide 'compare-w)
152 162