From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#37488: 27.0.50; Inconsistent naming of arg of `text-property-search-forward' and `-backward' Date: Thu, 26 Sep 2019 22:24:47 +0300 Message-ID: <835zlelv28.fsf@gnu.org> References: <87y2yfo8fv.fsf@web.de> <834l10oj0n.fsf@gnu.org> <87lfucv7n5.fsf@gnus.org> <83sgokmnch.fsf@gnu.org> <87h84zdrbl.fsf@gnus.org> <83impfkmxp.fsf@gnu.org> <87pnjmj2bg.fsf@gnus.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="114397"; mail-complaints-to="usenet@blaine.gmane.org" Cc: michael_heerdegen@web.de, lekktu@gmail.com, 37488@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 26 21:26:22 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iDZPB-000TcM-7J for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 21:26:21 +0200 Original-Received: from localhost ([::1]:43494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDZP9-0005np-Q8 for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 15:26:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52678) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDZOu-0005lS-5N for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:26:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDZOs-0002Cr-JT for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:26:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDZOs-0002Cd-G8 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDZOs-0002F9-AQ for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Sep 2019 19:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37488 X-GNU-PR-Package: emacs Original-Received: via spool by 37488-submit@debbugs.gnu.org id=B37488.15695259088553 (code B ref 37488); Thu, 26 Sep 2019 19:26:02 +0000 Original-Received: (at 37488) by debbugs.gnu.org; 26 Sep 2019 19:25:08 +0000 Original-Received: from localhost ([127.0.0.1]:45258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDZO0-0002Ds-GV for submit@debbugs.gnu.org; Thu, 26 Sep 2019 15:25:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDZNy-0002DJ-G2 for 37488@debbugs.gnu.org; Thu, 26 Sep 2019 15:25:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDZNs-0000y0-Tb; Thu, 26 Sep 2019 15:25:00 -0400 Original-Received: from [176.228.60.248] (port=4271 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iDZNs-0000MU-2C; Thu, 26 Sep 2019 15:25:00 -0400 In-reply-to: <87pnjmj2bg.fsf@gnus.org> (message from Lars Ingebrigtsen on Thu, 26 Sep 2019 21:16:19 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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: 209.51.188.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:167323 Archived-At: > From: Lars Ingebrigtsen > Cc: michael_heerdegen@web.de, lekktu@gmail.com, 37488@debbugs.gnu.org > Date: Thu, 26 Sep 2019 21:16:19 +0200 > > Eli Zaretskii writes: > > >> (text-property-search-forward 'face 'bold nil) > >> > >> and > >> > >> (text-property-search-forward 'face 'bold > >> (lambda (val p-val) (not (equal val p-val)))) > >> > >> The latter will stop every time 'face changes, while the former stops in > >> a way that segments the buffer in all the regions that have not 'face > >> 'bold. > > > > You are saying that the latter will also stop where there's no 'face' > > property at all, while the former will only stop where there _is_ > > 'face', but it is not 'bold'? IOW, nil is equivalent to > > > > (lambda (val p-val) (and p-val (not (equal val p-val)))) > > No, not the same, I'm afraid. nil means "when looping over this search, > give me all regions where 'face is not bold", while your predicate will > give you all regions where there is a 'face property, but it's not nil. OK, the example is bad, but I did get the meaning. > >> >> What it's meant to do is basically how TAB works in buttons, which is a > >> >> common use case. If you're looking for "o", and point is where "|" is > >> >> below, then it'll find the last "oo" section after the x-es: > >> >> > >> >> oo|oxxxxxoo > >> > > >> > What does "o" stand for in this case? > >> > >> Text with "o" as the property. > > > > But then the code should reject the second "oo" section because the > > value of the property there is equal to the value at point. Right? > > Oh, that's the confusion. By "doesn't include point", I meant "doesn't > include the region point was at when the search started". But that's not what the code seems to do. It just compares the value of property in the found region with that at point. In this example, they both are "o", so the code will reject the "oo" region at the end, and try to find the next one (and fail, because there's none). > >> > I don't understand how this answers my questions. > >> > >> Try (text-property-search-forward 'face) on the example. It'll give you > >> all regions that has a face property. > > > > That's a weird way to get to the result, if someone wants it. > > Seems like the obvious way to me. The obvious one would be to call next-single-property-change.