From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Graner Newsgroups: gmane.emacs.bugs Subject: bug#47564: text-property-search-forward does not behave as advertized Date: Fri, 02 Apr 2021 16:08:17 +0200 Message-ID: <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="4939"; mail-complaints-to="usenet@ciao.gmane.io" To: 47564@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 02 16:09:10 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 1lSKU1-0001AR-RC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Apr 2021 16:09:09 +0200 Original-Received: from localhost ([::1]:38634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSKU0-0005Gt-SE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Apr 2021 10:09:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSKTu-0005GZ-8c for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 10:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49259) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lSKTu-00043R-0l for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 10:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lSKTt-0006Cs-Pb for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 10:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Graner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Apr 2021 14:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47564 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161737251723823 (code B ref -1); Fri, 02 Apr 2021 14:09:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Apr 2021 14:08:37 +0000 Original-Received: from localhost ([127.0.0.1]:60805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lSKTV-0006CB-Jj for submit@debbugs.gnu.org; Fri, 02 Apr 2021 10:08:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:40222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lSKTT-0006C2-JU for submit@debbugs.gnu.org; Fri, 02 Apr 2021 10:08:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSKTQ-0005E0-65 for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 10:08:33 -0400 Original-Received: from smtp26.services.sfr.fr ([93.17.128.199]:60057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSKTJ-0003ha-SF for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 10:08:30 -0400 Original-Received: from hypra-graner (1.124.67.86.rev.sfr.net [86.67.124.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by msfrf2616.sfr.fr (SMTP Server) with ESMTPS id 9C3751C001405 for ; Fri, 2 Apr 2021 16:08:18 +0200 (CEST) X-mail-filterd: 1.0.0 X-sfr-mailing: LEGIT X-sfr-spamrating: 40 X-sfr-spam: not-spam DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=graner.name; s=202006; t=1617372498; h=From:To:Subject:Date; bh=ARw7QIo0aH7s9t4mB+6cS7UVbAf+RmYBfjV gGnCXrBI=; b=fGbK3lgWfLiA+/ZUNivR8jZOtcoh2zWl13/4/PXdpfgGmrNXrLtr5cvx40S4fRT vJ1Ck9+169+zsAyopvndV0eU1ot0c1MJZM1yjONYb6eTBsTSn+HOAcQK1MCpmnSkFEKAu4laxMFs Q0hG6vyD3O3E/vgp1GZSxcs4fZrUeUC6HhsuGCg+/G7iFDLWWZlc6tRb/Mzk8Cgy1oBmScvhvgCR vECTofa7EIErZaobBj/1gjRtYt1O87PCADdAxA2oA44LBqgFKqmSb2o8PAdzPB7sq1NQ/hb//dYJ 3WksGxeZWr+dBTFHv4QkeeeyJSBZYYaIhoimJuSv7ntY2zcB07w==; Original-Received: from hypra-graner (1.124.67.86.rev.sfr.net [86.67.124.1]) by msfrf2616.sfr.fr (SMTP Server) with ESMTP id 7999F1C001407 for ; Fri, 2 Apr 2021 16:08:18 +0200 (CEST) Original-Received: from hypra-graner (1.124.67.86.rev.sfr.net [86.67.124.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by msfrf2616.sfr.fr (SMTP Server) with ESMTPS for ; Fri, 2 Apr 2021 16:08:18 +0200 (CEST) Received-SPF: pass client-ip=93.17.128.199; envelope-from=nicolas.graner@sfr.fr; helo=smtp26.services.sfr.fr X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:203468 Archived-At: I found some discrepancies between the behavior of text-property-search-forward and text-property-search-backward, and what the doc says they should do. I am not sure whether they are bugs or documentation errors, except for the last one below which is clearly a bug. Here is how to reproduce starting from an empty buffer, tested on 28.0.50. I have inserted comments with my observations. (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. (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. (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. (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. Hope this helps, Nicolas