From: Glenn Morris <rgm@gnu.org>
To: Jonathan Goldblatt <jonathangoldblatt@yahoo.com>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: Bug/Patch view.el
Date: Mon, 24 Sep 2007 22:30:39 -0400 [thread overview]
Message-ID: <h0sl531now.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <qjps07amit.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon, 24 Sep 2007 15:31:06 -0400")
Eventually I settled on this version, which reduces the number of
operations in the loop.
(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 1)
(noerror 'move))
(when (< times 0)
(setq times (- times)
step -1
noerror t))
;; Note that we do not check the current line.
(while (and (> times 0)
(zerop (forward-line step)))
;; Move only to handle eob in the forward case: on last line,
;; (forward-line 1) returns 0 before the end of line.
(or (re-search-forward regexp (line-end-position) noerror)
(setq times (1- times)))))
(when (zerop times)
(forward-line 0)
(looking-at ".*")))
next prev parent reply other threads:[~2007-09-25 2:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1t8x7bfyoe.fsf@totally-fudged-out-message-id>
2007-09-22 18:39 ` Bug/Patch view.el Glenn Morris
2007-09-24 11:35 ` Jonathan Goldblatt
2007-09-24 19:31 ` Glenn Morris
2007-09-25 2:30 ` Glenn Morris [this message]
2007-09-25 7:06 ` Glenn Morris
2007-09-12 19:52 Jonathan Goldblatt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=h0sl531now.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=bug-gnu-emacs@gnu.org \
--cc=jonathangoldblatt@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.