Subject: Re: bug#64049: 30.0.50; Minor search_buffer cleanup

From: Po Lu <[email-masked]>
Date: Wed, 14 Jun 2023 08:25:02 +0800

Basil Contovounesios <[email-masked]> 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.