From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#25193: [PATCH] Improve the doc of re-search-forward and re-search-backward. Date: Mon, 12 Dec 2016 19:20:31 -0800 Message-ID: <1481599231-19381-1-git-send-email-hong@topbug.net> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1481599275 14377 195.159.176.226 (13 Dec 2016 03:21:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2016 03:21:15 +0000 (UTC) To: 25193@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 13 04:21:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGdeQ-00034O-Mr for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Dec 2016 04:21:10 +0100 Original-Received: from localhost ([::1]:35080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGdeU-0003T0-SI for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Dec 2016 22:21:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGdeL-0003Rl-Qz for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:21:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGdeI-0000vp-MG for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:21:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cGdeI-0000vk-It for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cGdeI-0005Lz-DZ for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Dec 2016 03:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25193 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148159925320543 (code B ref -1); Tue, 13 Dec 2016 03:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Dec 2016 03:20:53 +0000 Original-Received: from localhost ([127.0.0.1]:39946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGde9-0005LG-HT for submit@debbugs.gnu.org; Mon, 12 Dec 2016 22:20:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43769) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGde7-0005L3-UD for submit@debbugs.gnu.org; Mon, 12 Dec 2016 22:20:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGde1-0000qa-Lq for submit@debbugs.gnu.org; Mon, 12 Dec 2016 22:20:46 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57535) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cGde1-0000qT-IS for submit@debbugs.gnu.org; Mon, 12 Dec 2016 22:20:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGde0-0003IQ-Ab for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:20:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGddu-0000og-Pn for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:20:44 -0500 Original-Received: from sender163-mail.zoho.com ([74.201.84.163]:21453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cGddu-0000o4-HP for bug-gnu-emacs@gnu.org; Mon, 12 Dec 2016 22:20:38 -0500 Original-Received: from localhost (cpe-104-32-170-214.socal.res.rr.com [104.32.170.214]) by mx.zohomail.com with SMTPS id 1481599232121210.5515301411035; Mon, 12 Dec 2016 19:20:32 -0800 (PST) X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:126964 Archived-At: * search.c (Fre_search_forward, Fre_search_backward): Improve doc. --- src/search.c | 58 ++++++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/src/search.c b/src/search.c index 9f55d728362a..81edc27ecdc8 100644 --- a/src/search.c +++ b/src/search.c @@ -2257,26 +2257,12 @@ See also the functions `match-beginning', `match-end' and `replace-match'. */) DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, "sRE search backward: ", - doc: /* Search backward from point for match for regular expression REGEXP. -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 not begin before 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, position at 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. -With COUNT positive, 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; correspondingly with COUNT negative. - -Search case-sensitivity is determined by the value of the variable -`case-fold-search', which see. + doc: /* Search backward from point for regular expression REGEXP. +This function is almost identical to `re-search-forward', except for +that by default it searches backward instead of forward, and the sign +of COUNT also indicates exactly the opposite searching direction. -See also the functions `match-beginning', `match-end', `match-string', -and `replace-match'. */) +See `re-search-forward' for details. */) (Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) { return search_command (regexp, bound, noerror, count, -1, 1, 0); @@ -2286,21 +2272,25 @@ DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4, "sRE search: ", doc: /* Search forward from point for regular expression REGEXP. Set point to the end of the occurrence found, and return point. -An optional second argument bounds the search; it is a buffer position. - The match found must not end after that position. A value of nil - means search to the end 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 - backward, instead of forward, for -COUNT occurrences. A value of - nil means the same as 1. -With COUNT positive, the match found is the COUNTth one (or first, - if COUNT is 1 or nil) in the buffer located entirely after the - origin of the search; correspondingly with COUNT negative. - -Search case-sensitivity is determined by the value of the variable -`case-fold-search', which see. +The optional second argument BOUND is a buffer position that bounds + the search. The match found must not end after that position. A + value of nil means search to the end of the accessible portion of + the buffer. +The optional third argument NOERROR indicates how errors are handled + when the search fails. If it is nil or omitted, emit an error; if + it is t, simply return nil and do nothing; if it is neither nil nor + t, move to the limit of search and return nil. +The optional fourth argument COUNT is a number that indicates the + search direction and the number of occurrences to search for. If it + is positive, search forward for COUNT successive occurrences; if it + is negative, search backward, instead of forward, for -COUNT + occurrences. A value of nil means the same as 1. +With COUNT positive/negative, the match found is the COUNTth/-COUNTth + one in the buffer located entirely after/before the origin of the + search. + +Search case-sensitivity is determined by the variable +`case-fold-search'. See also the functions `match-beginning', `match-end', `match-string', and `replace-match'. */) -- 2.1.4