From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#31584: 27.0.50; Document again what match re-search-backward finds Date: Thu, 24 May 2018 18:14:44 -0400 Message-ID: <87wovsg0q3.fsf@gmail.com> References: <87in7cg2qw.fsf@web.de> <87wovsg27f.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1527199991 16122 195.159.176.226 (24 May 2018 22:13:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 24 May 2018 22:13:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 31584@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 25 00:13:07 2018 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 1fLyTm-0003zY-AJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 May 2018 00:13:02 +0200 Original-Received: from localhost ([::1]:40878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLyVt-0000l0-Hn for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 May 2018 18:15:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLyVm-0000j4-Ho for bug-gnu-emacs@gnu.org; Thu, 24 May 2018 18:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLyVi-0005T2-GS for bug-gnu-emacs@gnu.org; Thu, 24 May 2018 18:15:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fLyVi-0005Sw-8p for bug-gnu-emacs@gnu.org; Thu, 24 May 2018 18:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fLyVi-0007HM-2u for bug-gnu-emacs@gnu.org; Thu, 24 May 2018 18:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 May 2018 22:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31584 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31584-submit@debbugs.gnu.org id=B31584.152720009327952 (code B ref 31584); Thu, 24 May 2018 22:15:02 +0000 Original-Received: (at 31584) by debbugs.gnu.org; 24 May 2018 22:14:53 +0000 Original-Received: from localhost ([127.0.0.1]:47018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fLyVZ-0007Gm-Fx for submit@debbugs.gnu.org; Thu, 24 May 2018 18:14:53 -0400 Original-Received: from mail-io0-f178.google.com ([209.85.223.178]:37692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fLyVX-0007Ga-8t for 31584@debbugs.gnu.org; Thu, 24 May 2018 18:14:51 -0400 Original-Received: by mail-io0-f178.google.com with SMTP id e20-v6so4189785iof.4 for <31584@debbugs.gnu.org>; Thu, 24 May 2018 15:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Sygr0LvSYaOsvt0eSUSp/9aCPlm5j+vsAsFWgYDN+8I=; b=aVQlWDa7u9jFea0eLLJ7tzCdX0kviS20Yd32kDYDFGhNMxcLOJDx0833iQT0m3wPfc saf1viQYdnvYd1fxtM5t5aSWhsEcSy8mvbSBn+ENF44/O2s2sFQisH073FZOXmCLugi7 Y5VyXvogXU+aw3/89HIpwk2JPI4SCFF1Nssq2xvAAcb0U3r8zchrfzsOdyPxPWraeHXS 35BkreQlF/unVdzT8dBTbMlfqL4n8740LsInb4Jc7g+lTR1CekM3/ySMg5WKLMGu7Iy1 QlXxYendE5YDzFZlOzZFBf7a9GLg6CIAvK+sdA9xf7EDWHMaVTS+OeKw/RMcVVFfditD IQPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Sygr0LvSYaOsvt0eSUSp/9aCPlm5j+vsAsFWgYDN+8I=; b=g7L5zhraI601JCKfksYtk3TmQkUK1vuPeXI7VVibyDJEHsGjpxbPQPEAqxp0egaWbB 21Dt4+8hrdf4CqgUMnMPaNuHwNjqJZB8GEsGzGFSGLj4adJdGrD439K7jT7nUcUOfIPh +wSidRRgsIXH2MW/nPJYTGrOZ0fFWk+DGudb5v+WG/NzFsUFQHW+29uNSRhrU9UCF1Hv kUOR3cDcxevNr9/va1P4zz/VIWSM30ZIBMVIXTlhvpVm2nW4uD9pONOajvRGvlmgQlb/ TkO5H3dv8JL8VBb7o1REjg+c5hkwQ4mga9OsoYFPxQg9MPEyIwx/XgskmlABpIRYxYlc u+kA== X-Gm-Message-State: ALKqPwdeRsE+q87RoWTVqvZzhfR7B25ZnG/dop1BrklF02+nE6SeBndO zX7Ru7WWhtKFyc7U7QbdMXAyNt48 X-Google-Smtp-Source: AB8JxZr2ZK9mbBi/Y18n1k0Iq7sfamH7O/VxwmkKoxgCYrqsyQ+buPMFOobTeXVKw6lAyNbK2D1+Uw== X-Received: by 2002:a6b:710f:: with SMTP id q15-v6mr6614023iog.193.1527200085573; Thu, 24 May 2018 15:14:45 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id e22-v6sm6546964ita.0.2018.05.24.15.14.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 15:14:45 -0700 (PDT) In-Reply-To: <87wovsg27f.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 24 May 2018 14:42:44 -0700") 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:146507 Archived-At: Eric Abrahamsen writes: > Michael Heidegger writes: > >> >> (re-search-backward "a*") >> >> at the end of a line consisting only "a"s didn't move point. With >> today's documentation, that question can't be answered. The docstring should definitely be clarified, but technically it can still be answered, if you read very carefully: (re-search-backward REGEXP &optional BOUND NOERROR COUNT) Search backward from point for regular expression REGEXP. This function is almost identical to =E2=80=98re-search-forward=E2=80= =99, except that by default it searches backward instead of forward, and the sign of COUNT also indicates exactly the opposite searching direction. (re-search-forward REGEXP &optional BOUND NOERROR COUNT) [...] With COUNT positive/negative, the match found is [...] located entirely after/before the origin of the search. >> Some time ago, we had this sentence in the docstring: >> >> The match found is the one starting last in the buffer >> and yet ending before the origin of the search. >> >> but it has been removed. I think we need to say something like that, >> otherwise the semantics of backward re search is unclear. Yeah, it is sufficiently surprising that it should be called out specifically. > I've been bitten by this before. I'm sure the sentence you cite is, > correct, but I would suggest something more explicit about backwards > searches. The most useful thing I could have read when I was wondering > why this didn't work would be something like: "re-search-backward always > behaves "non-greedily", i.e., it will find the shortest match before > point". It is greedy: (with-temp-buffer (insert "xxxxyyyy") (and (re-search-backward "x+y*" nil t) (match-string 0))) ;=3D> "xyyyy" Non-greedy wouldn't match any "y"s. It's a bit tricky to explain both correctly and clearly...