From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#47564: text-property-search-forward does not behave as advertized Date: Sat, 10 Apr 2021 18:27:41 +0200 Message-ID: References: <868s60wzhq.fsf@universite-paris-saclay.fr> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= 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="12803"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cc: stefan@marxist.se, 47564@debbugs.gnu.org To: Nicolas Graner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 10 18:28:11 2021 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 1lVGSx-0003Cx-4e for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 18:28:11 +0200 Original-Received: from localhost ([::1]:41762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVGSv-00036c-QU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 12:28:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVGSo-00036S-IV for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 12:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVGSo-0007Me-BX for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 12:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVGSo-0004e2-7X for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 12:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Apr 2021 16:28: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.161807207417839 (code B ref 47564); Sat, 10 Apr 2021 16:28:02 +0000 Original-Received: (at 47564) by debbugs.gnu.org; 10 Apr 2021 16:27:54 +0000 Original-Received: from localhost ([127.0.0.1]:53116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVGSf-0004df-Ou for submit@debbugs.gnu.org; Sat, 10 Apr 2021 12:27:54 -0400 Original-Received: from sonic312-26.consmr.mail.ir2.yahoo.com ([77.238.178.97]:40440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVGSc-0004dN-Du for 47564@debbugs.gnu.org; Sat, 10 Apr 2021 12:27:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1618072063; bh=3PQaIkYTzWHr2S6ZoxOTc3jZAPMWgBRAiDpOYxIPOOE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=XNLjqzyly+T1FtJ5JbtntnEJqad2GsxHlVVZvu0aT5vhzk3jbFFIQK1dqZQZ4i4e3LCmirL3h5jqMdN9Dg3FQToH0FOcU7DfPXOvAhIiORWN01zgBljWS5n9wVY5zO1mfy7qEm2+WzCNnclKv5QHgqIKHRo/9npJQorLLsuJwXLl3MLioCIrDGrQ0CKshH1ZioVnXPUSHA3tEyxm6aWf5yBUeo0uofwpYKVsxpSqMX9qvKLa2tyODTlVIPJ7Dk+DfWXGrKvvTHZAs9czACNWvb1NbyKRG3gtQLC+5svn5WQsmLz2q2T3EK2+3bRnd0ETbIoirLuxYlqSgUfkCcCIaA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1618072063; bh=s2ssCyyTcefGRkCQCum00C/YERu+82PcQ6cmhbU+mH2=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Q/Gb1YTskA1tDiMGr/GLKTRv0WfQBEhqAPyZ419gVcXvBMHNrqHc103ZJfqOPxUuq0aDXr+9ib78xnFN7ssizEnUsS7wcTW+SwKTK9JxITZk4Cobj6nszyIR2GHc888sa+tn49OhUsneAqyjLqMiJ6jB773/xXSHzhraT3g5TipRaNr5w3FkdTe8+bi2SKMB/KsiDn81fK9PJ//GtM15bB8IfoweYVpe2GQtmP+X9C2FtylBcQZYxIwl/Xjmd6YTqW8JnJvFGpiEWPfb8KE0dC/1PHNJvlllsaeQJ+mzIrmgE8ktzksczYnrQXIh2qq+2xWecn9seeUZO45QndscEw== X-YMail-OSG: 6YTxryMVM1kML_HLaPCA93bWIHfqsLVC46XsXspz1f3aXB6xD.Lo0EAjdP3FYgF gHwfEjp8tpZJwMIa6CFrF1JchdYb3kihT9NsabwGLNAC9JDcghC7_9ftQoPKzj7a8uddA.RyaYr4 T18S8lEzV2J2sDFEkJnJhlXOl.uqQfiWePe4Ujg8RJKy03p10I7mM23hA.fFkInnbazwWHhNdDWh uSgMZdVQ1x82iUVe_G6jsD0.Q4zj3K3i0gr0lgp5RAATtoPp6W0bN8fx0S8SN9pEl_bvb1u5MrlC ikUhZeGXCqXdsmu_iPwDAJLfqjOPin5KVAm89HkfVE0VOnRhflnG30lodU3zqSk_asUsYW24Eq8T PqZEgxcJTCkbtqKp7AKm32FW6Jk067OmcT4J9kYHblM9PgeG7zkboePeYtXjZAwg6eSFWdNAsoVL UsMYF1U33bn.crAxgeLSPQiD0CNcyynVECacu4jGb5AKJl5V.ydC_j_qWU0QfksxovUG74S2pYwg L5EHsHmZlxnmn_13oKI.EGQ0Mh7HRtRIe5.66f6BGs3T0bWz5.xf4DzOQlRghgJBtps33Q._HOY5 rhMU3OxzbD9WTFzB.7PujOj3OLHedbTLR2muTAHEqzQgfjTGTyc.mkfLnlRwbG9vuMdivxcXSLzl 3YRWfyqHX_6EL479FQQ0mVhNAs12rmzxpGWc_uumQll1SmL_ZXXeVauRogzoCuJFA53_1YqKzUYj OiXyewhSJaZl2.ogZOWq0IhkJqKP5bkaXZ0ljMlj8pJU3Llsll4Y8ywiEAcN3CUhPuBhFXSYh9rC lY1hMjj4bNuDBTtnbADsTD5pfojm76H3Ucmdhxpih. X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Sat, 10 Apr 2021 16:27:43 +0000 Original-Received: by kubenode532.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 14d753fc106af02f903b2f70d8661a5c; Sat, 10 Apr 2021 16:27:42 +0000 (UTC) In-Reply-To: <868s60wzhq.fsf@universite-paris-saclay.fr> (Nicolas Graner's message of "Fri, 02 Apr 2021 16:08:17 +0200") X-Mailer: WebService/1.1.18121 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/16) 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:203804 Archived-At: 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=3Db295174210465c4285= 729c67ec014e0f5b53f741, 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. > (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. > (goto-char 9) > (text-property-search-backward 'foo 'bar t) > ;; moves point to 3 and returns range 3 to 6 > ;; As above, consistently moves to beginning of range instead of end. I think this is the same documentation bug as the first one. > (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.