summaryrefslogtreecommitdiff
path: root/lisp/compare-w.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-11-07 22:19:57 +0000
committerRichard M. Stallman <rms@gnu.org>1993-11-07 22:19:57 +0000
commit78a5302233f8550270b1e1bc68a959243586af9f (patch)
tree688a6715fe885c525126c07a42a405dc79bc3f76 /lisp/compare-w.el
parentc2da72f281697af2af6f8d0a285a5d485c2c6bfe (diff)
downloademacs-78a5302233f8550270b1e1bc68a959243586af9f.tar.gz
(compare-windows-skip-whitespace): Return t
if there is whitespace before point.
Diffstat (limited to 'lisp/compare-w.el')
-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."
;; 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)