From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#47564: text-property-search-forward does not behave as advertized Date: Wed, 29 Jun 2022 12:44:14 +0200 Message-ID: <87k08zkav5.fsf@gnus.org> References: <868s60wzhq.fsf@universite-paris-saclay.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15214"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: stefan@marxist.se, 47564@debbugs.gnu.org, Nicolas Graner To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 29 12:45:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6VC8-0003kw-Kw for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 12:45:16 +0200 Original-Received: from localhost ([::1]:49734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6VC7-0004Bs-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 06:45:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6VBu-00049h-Nx for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 06:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6VBu-0005lw-F1 for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 06:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6VBu-000260-Aq for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 06:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jun 2022 10:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47564 X-GNU-PR-Package: emacs Original-Received: via spool by 47564-submit@debbugs.gnu.org id=B47564.16564994727986 (code B ref 47564); Wed, 29 Jun 2022 10:45:02 +0000 Original-Received: (at 47564) by debbugs.gnu.org; 29 Jun 2022 10:44:32 +0000 Original-Received: from localhost ([127.0.0.1]:57714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6VBM-00024a-CL for submit@debbugs.gnu.org; Wed, 29 Jun 2022 06:44:32 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:58440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6VBK-00024G-1X for 47564@debbugs.gnu.org; Wed, 29 Jun 2022 06:44:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=X27882Jfw2aDZ4QJrdu0nSfgIDgogFZOPaRwYkkFvHA=; b=K+kOkAVZtdPB3AMI5rPhZozNRY HkFjDqSoFYBi9QivQP6swXgPfSP0434jYF6kaJbrn+iy1WXUKRJfu4rvt7W3ct0IisflEAR+4b86z 5h5Oj/mgPYwFfVQ60iYjn4bUkGZI3IqKIZ5u3yTT2+YzHjihYzhH4thvDTMKbQI6N4qM=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6VB8-0006Ux-NI; Wed, 29 Jun 2022 12:44:17 +0200 X-Now-Playing: The Body's _I've Seen All I Need To See_: "A Pain Of Knowing" In-Reply-To: ("Daniel =?UTF-8?Q?Mart=C3=ADn?="'s message of "Sat, 10 Apr 2021 18:27:41 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235617 Archived-At: Daniel Mart=C3=ADn writes: > Nicolas Graner writes: >> (insert "12345678") >> (put-text-property 3 6 'foo 'bar) >> (goto-char 1) >> (text-property-search-forward 'foo 'bar t) >> ;; moves point to 6 and returns range 3 to 6 >> ;; Doc says it should move the point to start of range, but it >> ;; consistently moves to end of range. > > I see this was changed in > https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3Db295174210465c42= 85729c67ec014e0f5b53f741, > but I don't know about the reasons for the change. In any case, the > docstring is now inconsistent with the documentation in the Elisp > manual, which says that point is placed at the end (which matches the > implementation). I've CC Stefan, but I think the docstring error is > that `text-property-search-forward' moves point to the end of the > matched region, and `text-property-search-backward' moves point to the > beginning of the matched region. (I'm going through old bug reports that unfortunately weren't resolved at the time.) Looking at the manual and the doc strings, they seem to be in agreement on this point (in Emacs 29, at least). >> (goto-char 1) >> (text-property-search-forward 'foo 'bar nil) >> ;; moves point to 3 and returns range 1 to 3, whre property foo is nil. >> ;; Doc says: with PREDICATE nil, a value will match if it is >> ;; non-nil and is NOT =E2=80=98equal=E2=80=99 to VALUE. >> ;; In fact, the condition "it is non-nil" is apparently ignored. > > After reading the code, I'd say you're correct and the "non-nil" is > ignored in the implementation. This part was added in response to this > bug report: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D37488, perhaps > I'm missing something. I've re-re-rewritten the documentation here after that a while ago (because most of the additions there weren't correct). >> (goto-char 7) >> (text-property-search-backward 'foo 'bar t) >> ;; returns nil. This one is really weird, considering it works OK from >> ;; position 6 or 8. As if there was something special when you start 1 >> ;; after the end of a range. > > Yes, this seems like an off-by-one error in the implementation. Looks like this has been fixed in the meantime. So I think that everything here has been fixed by now (at least in Emacs 29), so I'm closing this bug report. If any of these issues still remain, please open a new bug report for those issues. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no