+;; Move forward over whatever might be called whitespace.
+;; compare-windows-whitespace is a regexp that matches whitespace.
+;; Match it at various starting points before the original point
+;; and find the latest point at which a match ends.
+;; Don't try starting points before START, though.
+;; Value is non-nil if whitespace is found.
+
+;; If there is whitespace before point, but none after,
+;; then return t, but don't advance point.
+(defun compare-windows-skip-whitespace (start)
+ (let ((end (point))
+ (beg (point))
+ (opoint (point)))
+ (while (or (and (looking-at compare-windows-whitespace)
+ (<= end (match-end 0))
+ ;; This match goes past END, so advance END.
+ (progn (setq end (match-end 0))
+ (> (point) start)))
+ (and (/= (point) start)
+ ;; Consider at least the char before point,
+ ;; unless it is also before START.
+ (= (point) opoint)))
+ ;; keep going back until whitespace
+ ;; doesn't extend to or past end
+ (forward-char -1))
+ (setq beg (point))
+ (goto-char end)
+ (or (/= beg opoint)
+ (/= end opoint))))
+