aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-09-25 07:06:16 +0000
committerGlenn Morris2007-09-25 07:06:16 +0000
commit138c66b0dc82bb10283e495e7ac35d43efa5c899 (patch)
treedfdc1af2e0dc81bda79fec065b7602a1ea542d06
parent65b37d566389bc1bb6ce6cb597369746eea5691f (diff)
downloademacs-138c66b0dc82bb10283e495e7ac35d43efa5c899.tar.gz
emacs-138c66b0dc82bb10283e495e7ac35d43efa5c899.zip
(view-search-no-match-lines): Fix previous change (went wrong if
regexp to not be matched matched last thing in the buffer).
-rw-r--r--lisp/view.el23
1 files changed, 10 insertions, 13 deletions
diff --git a/lisp/view.el b/lisp/view.el
index 04f288a75d2..c152383a48b 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -998,22 +998,19 @@ for highlighting the match that is found."
998 "Search for the TIMESth occurrence of a line with no match for REGEXP. 998 "Search for the TIMESth occurrence of a line with no match for REGEXP.
999If such a line is found, return non-nil and set the match-data to that line. 999If such a line is found, return non-nil and set the match-data to that line.
1000If TIMES is negative, search backwards." 1000If TIMES is negative, search backwards."
1001 (let ((step 1) 1001 (let ((step (if (>= times 0) 1
1002 (noerror 'move)) 1002 (setq times (- times))
1003 (when (< times 0) 1003 -1)))
1004 (setq times (- times)
1005 step -1
1006 noerror t))
1007 ;; Note that we do not check the current line. 1004 ;; Note that we do not check the current line.
1008 (while (and (> times 0) 1005 (while (and (> times 0)
1009 (zerop (forward-line step))) 1006 (zerop (forward-line step)))
1010 ;; Move only to handle eob in the forward case: on last line, 1007 ;; (forward-line 1) returns 0 on moving within the last line.
1011 ;; (forward-line 1) returns 0 before the end of line. 1008 (if (eobp)
1012 (or (re-search-forward regexp (line-end-position) noerror) 1009 (setq times -1)
1013 (setq times (1- times))))) 1010 (or (re-search-forward regexp (line-end-position) t)
1014 (when (zerop times) 1011 (setq times (1- times))))))
1015 (forward-line 0) 1012 (and (zerop times)
1016 (looking-at ".*"))) 1013 (looking-at ".*")))
1017 1014
1018(provide 'view) 1015(provide 'view)
1019 1016