From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#9681: Broken behaviour of re-search-backward (.+ matching only a single character) Date: Fri, 7 Oct 2011 15:19:56 +0200 Message-ID: <20111007131956.GA11154@headley> References: <8762k21o09.fsf@gmail.com> <87ty7mymzw.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1317993972 20711 80.91.229.12 (7 Oct 2011 13:26:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2011 13:26:12 +0000 (UTC) Cc: 9681@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 07 15:26:07 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RCARB-0004Ku-7t for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Oct 2011 15:26:05 +0200 Original-Received: from localhost ([::1]:47182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCARA-0005ap-RA for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Oct 2011 09:26:04 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:39307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCAR5-0005aj-7Y for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 09:26:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCAQv-0000K2-EZ for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 09:25:59 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCAQv-0000Js-Bz for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 09:25:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RCAR9-0007Bu-B1 for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 09:26:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2011 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9681-submit@debbugs.gnu.org id=B9681.131799395127620 (code B ref 9681); Fri, 07 Oct 2011 13:26:02 +0000 Original-Received: (at 9681) by debbugs.gnu.org; 7 Oct 2011 13:25:51 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RCAQv-0007BP-9G for submit@debbugs.gnu.org; Fri, 07 Oct 2011 09:25:50 -0400 Original-Received: from mail-yx0-f172.google.com ([209.85.213.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RCAQs-0007B7-9W for 9681@debbugs.gnu.org; Fri, 07 Oct 2011 09:25:47 -0400 Original-Received: by yxt33 with SMTP id 33so3582870yxt.3 for <9681@debbugs.gnu.org>; Fri, 07 Oct 2011 06:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=xJu2fP/dTwdxs3rFGsZHI5Nmfd0jNYi2QTuNz38/9UE=; b=P6q6LuV05j4D3tRjUvC0uER5ay9oEZfk3kYmlujTeo1SMimCICB1yytGFMOO/2hU9e 5LijTi4EDyO6Y4+bDbcev/vy0DBqjDi2Yj6e+N7A4odWF7l6nj6BKF2rydEDpUD9OS07 /jeT2gXV9Yn83pSG4IgCalo8s6Bb5/A3uKKDs= Original-Received: by 10.223.15.25 with SMTP id i25mr10747393faa.31.1317993925854; Fri, 07 Oct 2011 06:25:25 -0700 (PDT) Original-Received: from localhost (176.119.broadband10.iol.cz. [90.177.119.176]) by mx.google.com with ESMTPS id h16sm12689961fab.19.2011.10.07.06.25.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Oct 2011 06:25:24 -0700 (PDT) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 07 Oct 2011 09:26:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:52374 Archived-At: On Fri, Oct 07, 2011 at 09:02:18AM -0400, Stefan Monnier wrote: > >> re-search-* stops at the first character position that has a match. > >> And then it chooses the longest match at that position. > > Thanks, but I'm not sure I understand what you mean here. Naturally, the > > longest match for `re-search-backward' should be backward, not forward, > > Ah, yes, sorry for being unclear: the search for a match goes backward, > but the matching itself goes forward. > > The docstring of re-search-backward is more clear about that: > > The match found is the one starting last in the buffer > and yet ending before the origin of the search. I suppose that is more clear if you already know the behaviour, but I didn't understand it that way, either. I think it should at least add that the match is still forward, not backward, and that it might not behave as expected for regexps containing constructs like * and +. > > If I'm the only one who considers this behaviour broken (by design?[1]), > > It's not the ideal behavior, admittedly. It's even more obvious in > `looking-back'. But fixing it would require the implementation of > a backward regexp matcher. Yeah, as I said above (and as is obvious in the message quoted in the bug report), the set of regexps usable with `re-search-backward' seems to be quite limited, and one has to be very careful when using it (and even some developers apparently fail at that). So, again: it definitely needs better documentation, and IMO it also needs fixing. -- Štěpán