From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#36486: [PATCH] Add tests for text-property-search to check prop-match-value Date: Fri, 12 Jul 2019 21:47:27 +0300 Organization: LINKOV.NET Message-ID: <87tvbrm6o0.fsf@mail.linkov.net> References: <87pnmndyu8.fsf@mouse.gnus.org> <87pnmlzbzt.fsf@mail.linkov.net> <874l3w5jwy.fsf@mail.linkov.net> <87r26zgdbq.fsf@mail.linkov.net> <87o921mskm.fsf@mail.linkov.net> <87muhkw7l9.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="87933"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 36486@debbugs.gnu.org, Stefan Kangas To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 12 20:59:12 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 1hm0lD-000MhW-4V for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 20:59:11 +0200 Original-Received: from localhost ([::1]:51900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hm0lC-0007CQ-1J for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 14:59:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36304) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hm0l6-00070K-5G for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 14:59:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hm0l4-0001Ro-Rq for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 14:59:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60151) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hm0l4-0001RO-NL for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 14:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hm0l3-000264-Lo for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 14:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jul 2019 18:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36486 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch fixed Original-Received: via spool by 36486-submit@debbugs.gnu.org id=B36486.15629579158006 (code B ref 36486); Fri, 12 Jul 2019 18:59:01 +0000 Original-Received: (at 36486) by debbugs.gnu.org; 12 Jul 2019 18:58:35 +0000 Original-Received: from localhost ([127.0.0.1]:40735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hm0kc-000253-Kr for submit@debbugs.gnu.org; Fri, 12 Jul 2019 14:58:34 -0400 Original-Received: from fossa.birch.relay.mailchannels.net ([23.83.209.62]:13532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hm0ka-00024u-8n for 36486@debbugs.gnu.org; Fri, 12 Jul 2019 14:58:33 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CACF21A14BB; Fri, 12 Jul 2019 18:58:30 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a71.g.dreamhost.com (100-96-11-126.trex.outbound.svc.cluster.local [100.96.11.126]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 068951A0A52; Fri, 12 Jul 2019 18:58:30 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a71.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.3); Fri, 12 Jul 2019 18:58:30 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Name-Daffy: 0138f07962b3b936_1562957910417_472682463 X-MC-Loop-Signature: 1562957910417:3733177685 X-MC-Ingress-Time: 1562957910417 Original-Received: from pdx1-sub0-mail-a71.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a71.g.dreamhost.com (Postfix) with ESMTP id 67EEA8020A; Fri, 12 Jul 2019 11:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=5knL/tazT7fHpVlPrGpl6fojYCM=; b= VRC2IoYOMZshFOJgt+IeLwPaWHXYui7M44g2z+SSSAtWo/vdjxXNL4pJEdx0nuup PRxNbmOv1EKKo6XWbP0ymDSQ4bEmw72spSyu95gTHceirOJXlQ9qyk5MCywh/4CG 6OfF2OWRZ4J0z41TK1MwVQ+wLLG6BP19G8ChMLqfU3I= Original-Received: from mail.jurta.org (m91-129-103-134.cust.tele2.ee [91.129.103.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a71.g.dreamhost.com (Postfix) with ESMTPSA id B162E801FF; Fri, 12 Jul 2019 11:58:20 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a71 In-Reply-To: (Lars Ingebrigtsen's message of "Fri, 12 Jul 2019 16:37:21 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrhedtgddufedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrddufeegnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtfedrudefgedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehlrghrshhisehgnhhushdrohhrghenucevlhhushhtvghrufhiiigvpedt 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:162801 Archived-At: --=-=-= Content-Type: text/plain >> - (not (equal val p-val)))))) >> + (not (if (and (listp p-val) (not (listp val))) >> + (member val p-val) >> + (equal val p-val))))))) > > No, that's not an acceptable change, I think -- this function is a > search primitive, not a DWIM thing. There's an abundance of things that > can be stored in text properties, to be compared with any number of > predicates. You're trying to special-case it to search for faces, for > some reason, and that's not what it's for. Then it's possible to add lambda to `predicate' arg in interactive spec only like below. > If you want a function to search for faces, that's something you can > write (based on this function), but that's not what this function is for. Of course, I can write and add it to ~/.emacs. But the question is: do you think this is generally useful? For example, to search hi-lock properties, etc. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=text-property-search-value.4.patch diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el index 41ca07057e..867094539f 100644 --- a/lisp/emacs-lisp/text-property-search.el +++ b/lisp/emacs-lisp/text-property-search.el @@ -54,10 +54,16 @@ text-property-search-forward that's matching), and `prop-match-value' (the value of PROPERTY at the start of the region)." (interactive - (list - (let ((string (completing-read "Search for property: " obarray))) - (when (> (length string) 0) - (intern string obarray))))) + (let* ((property (completing-read "Search for property: " obarray)) + (property (when (> (length property) 0) + (intern property obarray))) + (value (when property + (read-from-minibuffer "Search for property value (quote strings): " + nil nil t nil "nil")))) + (list property value (lambda (val p-val) + (not (if (and (listp p-val) (not (listp val))) + (member val p-val) + (equal val p-val))))))) (cond ;; No matches at the end of the buffer. ((eobp) --=-=-=--