Function: view-search-no-match-lines
view-search-no-match-lines is a byte-compiled function defined in
view.el.gz.
Signature
(view-search-no-match-lines TIMES REGEXP)
Documentation
Search for the TIMESth occurrence of a line with no match for REGEXP.
If such a line is found, return non-nil and set the match data to that line. If TIMES is negative, search backwards.
Source Code
;; Defined in /usr/src/emacs/lisp/view.el.gz
;; This is the dumb approach, looking at each line. The original
;; version of this function looked like it might have been trying to
;; do something clever, but not succeeding:
;; https://lists.gnu.org/r/bug-gnu-emacs/2007-09/msg00073.html
(defun view-search-no-match-lines (times regexp)
"Search for the TIMESth occurrence of a line with no match for REGEXP.
If such a line is found, return non-nil and set the match data to that line.
If TIMES is negative, search backwards."
(let ((step (if (>= times 0) 1
(setq times (- times))
-1)))
;; Note that we do not check the current line.
(while (and (> times 0)
(zerop (forward-line step)))
;; (forward-line 1) returns 0 on moving within the last line.
(if (eobp)
(setq times -1)
(or (re-search-forward regexp (line-end-position) t)
(setq times (1- times))))))
(and (zerop times)
(looking-at ".*")))