# HG changeset patch # User Richard M. Stallman # Date 752710797 0 # Node ID 76fb8b35df3faeb9bde6f77fbf75587a6a478668 # Parent fb527936ca612ecdcdd702af2e3f190ea3bb114c (compare-windows-skip-whitespace): Return t if there is whitespace before point. diff -r fb527936ca61 -r 76fb8b35df3f lisp/compare-w.el --- a/lisp/compare-w.el Sun Nov 07 21:23:36 1993 +0000 +++ b/lisp/compare-w.el Sun Nov 07 22:19:57 1993 +0000 @@ -134,19 +134,29 @@ ;; 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 (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))) + (while (or (and (/= (point) start) + ;; Consider at least the char before point, + ;; unless it is also before START. + (= (point) opoint)) + (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)))) ;; keep going back until whitespace ;; doesn't extend to or past end (forward-char -1)) + (setq beg (point)) (goto-char end) - (/= end opoint))) + (or (/= beg opoint) + (/= end opoint)))) (provide 'compare-w)