From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen 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 21:16:19 +0200 Message-ID: <87pnjmj2bg.fsf@gnus.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="163836"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: michael_heerdegen@web.de, lekktu@gmail.com, 37488@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 26 21:37:15 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 1iDZZi-000gSK-U8 for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 21:37:15 +0200 Original-Received: from localhost ([::1]:43788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDZZh-00019c-Qm for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Sep 2019 15:37:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50811) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDZGB-0004FB-Bn for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:17:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDZGA-0007kS-4b for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36412) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDZGA-0007kH-1F for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDZG9-0001yu-S2 for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2019 15:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Sep 2019 19:17:01 +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.15695253857544 (code B ref 37488); Thu, 26 Sep 2019 19:17:01 +0000 Original-Received: (at 37488) by debbugs.gnu.org; 26 Sep 2019 19:16:25 +0000 Original-Received: from localhost ([127.0.0.1]:45227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDZFZ-0001xb-Gx for submit@debbugs.gnu.org; Thu, 26 Sep 2019 15:16:25 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:39602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDZFY-0001xM-Bw for 37488@debbugs.gnu.org; Thu, 26 Sep 2019 15:16:24 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iDZFU-00071V-8N; Thu, 26 Sep 2019 21:16:22 +0200 In-Reply-To: <83impfkmxp.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 26 Sep 2019 20:05:38 +0300") 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:167327 Archived-At: 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. >> >> 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". >> >> > . What is the reason for having VALUE an optional argument? Is it a >> >> > frequent/useful operation to look for a VALUE of nil? >> >> >> >> If PREDICATE is nil, then having to use an explicit nil VALUE isn't >> >> necessary. >> > >> > 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. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no