From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Basil Contovounesios <contovob@tcd.ie>
Cc: 64049@debbugs.gnu.org
Subject: bug#64049: 30.0.50; Minor search_buffer cleanup
Date: Wed, 14 Jun 2023 08:25:02 +0800 [thread overview]
Message-ID: <87cz1yhov5.fsf@yahoo.com> (raw)
In-Reply-To: <87wn07clrw.fsf@epfl.ch> (Basil Contovounesios's message of "Tue, 13 Jun 2023 18:30:43 +0100")
Basil Contovounesios <contovob@tcd.ie> writes:
> * src/lisp.h (search_buffer): Turn RE flag/argument from an int into
> a bool. All callers updated.
We typically write ``All callers changed'' in ChangeLog, I think.
> +/* Search for the Nth occurrence of STRING in the current buffer,
> + from buffer position POS/POS_BYTE until LIM/LIM_BYTE,
> + treating STRING as a literal string if RE is false
> + or as a regular expression if RE is true.
> +
> + If N is positive, searching is forward and LIM must be greater than POS.
> + If N is negative, searching is backward and LIM must be less than POS.
> +
> + Returns -x if x occurrences remain to be found (x > 0),
> + or else the position at the beginning of the Nth occurrence
> + (if searching backward) or the end (if searching forward).
> +
> + TRT and INVERSE_TRT are translation tables.
> +
> + POSIX is true if we want full backtracking (POSIX style) for this pattern.
> + False means backtrack only enough to get a valid match. */
How about:
Search for the Nth occurence of STRING in the current buffer,
from buffer position POS/POS_BYTE until LIM/LIM_BYTE.
If RE, look for matches against the regular expression STRING instead;
if POSIX, enable POSIX style backtracking within that regular
expression.
If N is positive, search forward; in this case, LIM must be greater
than POS.
If N is negative, search backwards; LIM must be less than POS.
Return -X if there are X remaining occurrences or matches, or else the
position at the beginning (if N is negative) or the end (if N is
positive) of the Nth occurrence or match against STRING.
Use TRT and INVERSE_TRT as character translation tables.
next prev parent reply other threads:[~2023-06-14 0:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 17:30 bug#64049: 30.0.50; Minor search_buffer cleanup Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-14 0:25 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-06-14 13:26 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-08 15:46 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cz1yhov5.fsf@yahoo.com \
--to=bug-gnu-emacs@gnu.org \
--cc=64049@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=luangruo@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).