GNU bug report logs - #47564
text-property-search-forward does not behave as advertized

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Nicolas Graner <nicolas@HIDDEN>; dated Fri, 2 Apr 2021 14:09:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Apr 2021 14:08:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 02 10:08:37 2021
Received: from localhost ([127.0.0.1]:60805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lSKTV-0006CB-Jj
	for submit <at> debbugs.gnu.org; Fri, 02 Apr 2021 10:08:37 -0400
Received: from lists.gnu.org ([209.51.188.17]:40222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas.graner@HIDDEN>) id 1lSKTT-0006C2-JU
 for submit <at> debbugs.gnu.org; Fri, 02 Apr 2021 10:08:36 -0400
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 <nicolas.graner@HIDDEN>)
 id 1lSKTQ-0005E0-65
 for bug-gnu-emacs@HIDDEN; Fri, 02 Apr 2021 10:08:33 -0400
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 <nicolas.graner@HIDDEN>)
 id 1lSKTJ-0003ha-SF
 for bug-gnu-emacs@HIDDEN; Fri, 02 Apr 2021 10:08:30 -0400
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 <bug-gnu-emacs@HIDDEN>; 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==;
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 <bug-gnu-emacs@HIDDEN>; Fri,  2 Apr 2021 16:08:18 +0200 (CEST)
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 <bug-gnu-emacs@HIDDEN>; Fri,  2 Apr 2021 16:08:18 +0200 (CEST)
From: Nicolas Graner <nicolas@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: text-property-search-forward does not behave as advertized
Date: Fri, 02 Apr 2021 16:08:17 +0200
Message-ID: <868s60wzhq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=93.17.128.199; envelope-from=nicolas.graner@HIDDEN;
 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-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

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




Acknowledgement sent to Nicolas Graner <nicolas@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#47564; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 2 Apr 2021 14:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.