GNU bug report logs -
#23937
25.0.95; Search functions doc fixes/improvements
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Sun, 10 Jul 2016 18:22:01 UTC
Severity: minor
Found in version 25.0.95
Done: Stephen Berman <stephen.berman <at> gmx.net>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 23937 <at> debbugs.gnu.org (full text, mbox):
On Tue, 12 Jul 2016 08:03:25 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: 23937 <at> debbugs.gnu.org
>> Date: Mon, 11 Jul 2016 23:55:19 +0200
>>
>> >> @@ -2247,14 +2252,15 @@ DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward,
>> >> "sPosix search backward: ",
>> >> doc: /* Search backward from point for match for regular expression REGEXP.
>> >> Find the longest match in accord with Posix regular expression rules.
>> >> -Set point to the beginning of the match, and return point.
>> >> -The match found is the one starting last in the buffer
>> >> -and yet ending before the origin of the search.
>> >> +Set point to the beginning of the occurrence found, and return point.
>> >
>> > The 2nd and 3rd lines you removed seem to provide valuable information
>> > which is now gone, no?
>>
>> I removed them because I thought they were (i) partly redundant: the
>> first words of the doc string, "Search backward from point", already
>> imply that the match ends before that position, since otherwise it
>> wouldn't be a search backward
>
> I don't agree, I think this part is not clear unless explicitly
> described. I frequently find myself wondering about this when I
> need to code a loop that uses these functions.
>
>> and (ii) partly inaccurate: saying the
>> match found is the last one in the buffer before the starting point is
>> only true when COUNT is 1 (or nil)
>
> Then let's make it more accurate, but I don't think removing that is
> TRT. In particular, there's nothing wrong with describing what
> happens with COUNT = 1 if the clarity is required only in that case.
How about the following, which moves the two lines, rephrased for
accuracy, to the end of the doc string?
Set point to the beginning of the occurrence found, and return point.
An optional second argument bounds the search; it is a buffer position.
The match found must start at or after that position. A value of nil
means search to the beginning of the accessible portion of the buffer.
Optional third argument, if t, means if fail just return nil (no error).
If not nil and not t, move to limit of search and return nil.
Optional fourth argument COUNT, if a positive number, means to search
for COUNT successive occurrences. If COUNT is negative, search
forward, instead of backward, for -COUNT occurrences. A value of
nil means the same as 1.
The match found is the COUNTth to last one (or last, if COUNT is 1 or
nil) in the buffer located entirely before the origin of the search.
If you are ok with this, should I add these two lines to all
*search-backward and (suitably adapted) *search-forward functions? (The
two lines are currently only in {re,posix}-search-backward.)
Steve Berman
This bug report was last modified 8 years and 316 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.