GNU bug report logs - #35564
27.0.50; [PATCH] Tweak dired-do-shell-command warning about "wildcard" characters

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: Kévin Le Gouguec <kevin.legouguec@HIDDEN>; Keywords: patch; merged with #28969; dated Sat, 4 May 2019 18:03:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 35564) by debbugs.gnu.org; 29 Jul 2019 18:16:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 29 14:16:09 2019
Received: from localhost ([127.0.0.1]:49094 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hsABt-0002bO-Jk
	for submit <at> debbugs.gnu.org; Mon, 29 Jul 2019 14:16:09 -0400
Received: from bonobo.birch.relay.mailchannels.net ([23.83.209.22]:23172)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hsABq-0002bE-JV
 for 35564 <at> debbugs.gnu.org; Mon, 29 Jul 2019 14:16:08 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 86595503160;
 Mon, 29 Jul 2019 18:16:05 +0000 (UTC)
Received: from pdx1-sub0-mail-a43.g.dreamhost.com
 (100-96-11-214.trex.outbound.svc.cluster.local [100.96.11.214])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id AF2C65031DD;
 Mon, 29 Jul 2019 18:16:04 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a43.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.5); Mon, 29 Jul 2019 18:16:05 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Descriptive-Callous: 1059d018422c3203_1564424165174_1632112057
X-MC-Loop-Signature: 1564424165174:1834092828
X-MC-Ingress-Time: 1564424165174
Received: from pdx1-sub0-mail-a43.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTP id 6853A8307F;
 Mon, 29 Jul 2019 11:16:00 -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=6z2LIcybTxLuAjVySRuM3NkXE4c=; b=
 cwUNxYPkvBDbmUMR+zxoKS4dKk67PfkHxvhlFCm7rRBA6lHeItzWf0oyXU7x1dR1
 EUtYOfLas3dTnyHTlnsL9LEdlgRAd3zRBHSckyBg70CqnVrT/0PpeqL2+B7zoaD9
 pnQf8KWDthttlgsP9xT75XTVdHeB8voQttQLLldOXgc=
Received: from mail.jurta.org (m91-129-103-76.cust.tele2.ee [91.129.103.76])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTPSA id 8635483056;
 Mon, 29 Jul 2019 11:15:53 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a43
From: Juri Linkov <juri@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
Organization: LINKOV.NET
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
 <87wog3pewu.fsf@HIDDEN> <87v9vndsnj.fsf@HIDDEN>
 <87imrl4ixr.fsf@HIDDEN>
Date: Mon, 29 Jul 2019 21:11:08 +0300
In-Reply-To: <87imrl4ixr.fsf@HIDDEN> (Michael Heerdegen's message of "Mon, 29
 Jul 2019 05:29:36 +0200")
Message-ID: <87lfwhf8w3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrledugdduvdefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrdejieenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdefrdejiedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmihgthhgrvghlpghhvggvrhguvghgvghnseifvggsrdguvgenucevlhhushhtvghrufhiiigvpedt
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: npostavs@HIDDEN, 35564 <at> debbugs.gnu.org, monnier@HIDDEN,
 =?iso-8859-1?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
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: -1.0 (-)

> I dunno if the double emphasizing in the y-n-prompt (coloring +
> additional underlining with "^") is a bit too much.  A bit related:

Maybe additional underlining should be used only when the current
display doesn't support colors.

> Maybe the second line could be combined with the first line so that one
> line is saved.  I mean, the prompt is four lines high with this change,
> quite a lot.  Dunno what others think about it.

Then with using colors the prompt could fit into one line
(when the display supports colors).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 29 Jul 2019 03:30:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 28 23:30:00 2019
Received: from localhost ([127.0.0.1]:47477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrwMJ-0006FR-Ou
	for submit <at> debbugs.gnu.org; Sun, 28 Jul 2019 23:29:59 -0400
Received: from mout.web.de ([212.227.17.11]:55343)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hrwMG-0006FC-QD
 for 35564 <at> debbugs.gnu.org; Sun, 28 Jul 2019 23:29:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1564370981;
 bh=SPVkCy49K7oMfnlinj+7Ca19xdHQFoy01OkNL2i2HU8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=LXb2DCCmPaA0vlw053TGIbEYY0fbXtxTCNAwJ1mtunWSM4b0PxfX1/bUezS+v/VUi
 bjO6O9EeizEKPKFlBKHLoa7ElRFfj8VnYyRz57hP/j486xk3Tri/he700X/fd9cGIU
 z1DhrvkaYum17xoskOUw9GXeajEnZovtJclJV42Q=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([92.208.178.242]) by smtp.web.de (mrweb103
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M09hY-1ifVCj00mi-00uIS2; Mon, 29
 Jul 2019 05:29:41 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
 <87wog3pewu.fsf@HIDDEN> <87v9vndsnj.fsf@HIDDEN>
Date: Mon, 29 Jul 2019 05:29:36 +0200
In-Reply-To: <87v9vndsnj.fsf@HIDDEN> (Michael Heerdegen's message of "Sun, 28
 Jul 2019 00:22:40 +0200")
Message-ID: <87imrl4ixr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:NoVetfnANGCJgVzgWU5tmJuLZvTK+VJzIM883UCKzRIVejUBuoW
 MlOs8ntXRD+S/V63AuoKYfNXNsHhZ3lVw95UxMwnwJ8i/JJhhedEAeDZl2nFYwuU9O2luDJ
 L+VRtyPA0hsQWc5Wt1BzmrPrsMVLKy63k8+xMODrWte1BRPqVp56A3/mDtPVJAkwmf25Oa8
 jjUgzHeJ7vqvyb6INMajg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:ZWHdeNXsoF0=:6rbaJOEZKDd6fwHgJyAjg5
 k7g22wUnBdjz9Md4c5mtDXC6DNSrGfaqK9wn6yxdMP977QqBDjjtZYhauY/P0FyoE+Tqh5GYU
 mRB+07NeJO1qB+TZ+jWWI+MkelR9MGninjEHPHRhraLkC8J62P41I+SE5f2ttnXYx4yofXw3Z
 wBjjsoS8dJ0xB4jly0EftyAz/8gl4F80zyPDMLet1IZ24Ws4EQUsl9+5Lk7SLU6zWpZcDmYol
 iX4Md7HeGKYcUQJNzHOwGVnFfUoCMBQx01GLG13VcbRei8wgANNusZS1PhcGKiH2NSr+0eOYC
 HVvVlgczACHAsPk/Mt+g7AxbaKO9cOVpTBhhEX6/qCMxXjqbZ51kuP/5obnbOH+roxxrEWWfr
 6UsLeqCrx8NpbOw52UzgoFIownv/6k3CiTUK+ZUuYKFZ9W7VpfKoLb+cNyNGVcWHPS27Lia4Q
 fD2I8efopgGasH7CE5wYUuaiaboEPkryVrTGpFQYb0ue07EEBtqxt25X8vtfpY9pgy8YISUbm
 EmJLi6PTfV7zcaNkPMkZ7mS5upNiUY7ATh5isIEiV8gXsvdeE/X1dGIeTR+xAtSvdbukR667N
 9WuqSL23yerIioWFWot/ac825CMT65euwBjR3IqIpoiO4gPd37wKgNUihh3oCpxjVftCxFvtU
 JmA/qeXMtrPkSlGhlkkQs7KAZ6c7jKhFcSHAmOg4VwG56qcnWMjduT7oCtGG8o0H4uGV7drDp
 ls6PnyUjbXRWnQkwC1a3PZB/yBx0fXjvkz1RU3hJWSThKmeRd6Xc7rt78BZsdt1CxzI5DgFbi
 RblIx0AmP9afsteLPnC3u/mhBmLz6Z1tHNWh5y/QK9rNwXraNgkuL1k5CV7yKL7XrA7kJdzH8
 OamU/YA9F7vjvmNBx/FNOXcz0Ig/8DMp26NepR606qyHJhRhOgNTwleOD3EeUS2BwFO/NhPD+
 lIQgV2S69bbBJAv6oqUcFXMHtGemWwui6FrsihtV1yGWc23OMfUmmO3ZoLbeS4nQ/RcIb+0RD
 aEmyYGD5XcVtteVDkI+ZRH4YcusukOBEDtqNiIQGwRZnijPVasmGucTTG7AObogyAODhE1TH3
 ++cq0JYKTHDi+coRh7+9JPpfHpV6XFGoOxW
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, 35564 <at> debbugs.gnu.org,
 monnier@HIDDEN, npostavs@HIDDEN
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: -1.7 (-)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> I skimmed through the changes and have installed it, but I didn't yet
> try it.  Will do ASAP, hopefully tonight.

Ok, I did.  It worked well without problems, and nicely indicates the
questionable character(s).

I dunno if the double emphasizing in the y-n-prompt (coloring +
additional underlining with "^") is a bit too much.  A bit related:
Maybe the second line could be combined with the first line so that one
line is saved.  I mean, the prompt is four lines high with this change,
quite a lot.  Dunno what others think about it.

Anyway, I like it.

Thanks,

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 23:41:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 19:41:31 2019
Received: from localhost ([127.0.0.1]:45581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrWJe-0004pJ-My
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 19:41:30 -0400
Received: from mail-wr1-f54.google.com ([209.85.221.54]:45558)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1hrWJc-0004p5-Mb
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 19:41:29 -0400
Received: by mail-wr1-f54.google.com with SMTP id f9so57934084wre.12
 for <35564 <at> debbugs.gnu.org>; Sat, 27 Jul 2019 16:41:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=tcd-ie.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=+RuokGQqKBuczS8oAuLoeh0S552zO0prvh0UPL8YF1Y=;
 b=b0Pp4v2+nc7N/ybfT6lmwv6Nnc5WuCF9waGBqQstTrV84KJfF4/H/n6Ir2ZsM0Kjms
 u348jQgSlpIR5v+thWrTuft4ClbvP+ciedN9vKcf22XiwILS3oexj2CClcONZDATzHsZ
 AsWPs2va3CXbf940a1Rjf9TsQR2XcX5Q4DZVe1OEJGmQ6avDmD9XIda7cCrZy9Hp+ToM
 fh9MzXkr37Zcu/KIfJXDpqz41FGUsUftDa8xOE3C9gG9bGhFlRGRdfkD67wS+OpBmTPx
 n5gvD8lOQ4/ABjMJk+WHrpOz3rmQdVWdKa5vcpslWD9HyUxURFDWiZHhpLtKdfWXtdAt
 N6zA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=+RuokGQqKBuczS8oAuLoeh0S552zO0prvh0UPL8YF1Y=;
 b=SS3dbfe6aH+qqdcQQozUneJnWnAA53UD2qalG3aY7eZ15ZyJqzfr7Bt1n0mH9qlqs4
 YuxIpDMyL0/K5vwreuQPr7XHM3JAJ0XMBDLdbTOInsupBthnXiG1NP8MCBWodaFJX1B2
 ilUCbHOFOftWBWtDbUGe8S5V55T3zxgIhOuOODMUk5HsspeVA968EfelhlMNhW0KeeVw
 CA1W1qXVlKwq984yMsE7DmOhRZikOzKjfdxixXQv8pxMa1uSoSRUkeijDYkjkCPxZUkF
 HmwhH53ny4Y7Jt1Mhjz6WW6knK/ta+v5wfYd0BttWFw2mE+h2ze5ygE5tfNEYwCROIyu
 q5Fg==
X-Gm-Message-State: APjAAAXntiLVNjYLqW9Q6Sx5uaMMamMsNITQ6bCM3EW9+3qHnmAALiVO
 bKdva8SgFNFHET9RINsNPzTvrQ==
X-Google-Smtp-Source: APXvYqxw9klneHIJeOJmzOunHWL2RwL9y3LhiNI1/hstKH6MDsOTsuSJAXRgfYSiHJ5QorR16p7MJw==
X-Received: by 2002:a5d:4d81:: with SMTP id b1mr27984324wru.27.1564270882725; 
 Sat, 27 Jul 2019 16:41:22 -0700 (PDT)
Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2])
 by smtp.gmail.com with ESMTPSA id z6sm51050746wrw.2.2019.07.27.16.41.21
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sat, 27 Jul 2019 16:41:21 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
 <87imrn16fk.fsf@HIDDEN> <87lfwjoxz0.fsf@HIDDEN>
Date: Sun, 28 Jul 2019 00:41:20 +0100
In-Reply-To: <87lfwjoxz0.fsf@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Sun, 28 Jul 2019 01:32:19 +0200")
Message-ID: <87d0hvyrj3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, 35564 <at> debbugs.gnu.org,
 monnier@HIDDEN, npostavs@HIDDEN
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: -1.0 (-)

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> "Basil L. Contovounesios" <contovob@HIDDEN> writes:
>
>>> -(defun dired--no-subst-prompt (char-positions command)
>>> +(defun dired--mark-positions (positions)
>>> +  (let ((markers (make-string
>>> +                  (1+ (apply #'max positions))
>>
>> Is POSITIONS guaranteed to be non-nil?  (The max function takes at least
>> one argument.)
>
> AFAICT dired--mark-positions is only called by dired--no-subst-prompt,
> which is only used when there is at least one ambiguous character to
> highlight.
>
> So as things stand now, POSITIONS will always be non-nil.  Nothing
> prevents someone from attempting to re-use the function with a
> potentially-nil argument though.
>
> I don't know what makes more sense here: adding an assertion?  Handling
> the nil case explicitly for robustness?

I think it's fine the way it is, though a docstring/comment never hurts.
I was just checking.

>>> Subject: [PATCH 6/6] Simplify highlighting assertions
>>>
>>> * test/lisp/dired-aux-tests.el (dired-test--check-highlighting):
>>> New function.
>>> (dired-test-highlight-metachar): Use it.
>>
>> Will this simplification hinder debugging of test failures?  I don't
>> have an opinion on the proposed change, it's just something to consider.
>
> Mmm.  Since the assertion that fails is now nested in a more generic
> function, the report shown in the ERT-Results buffer might be somewhat
> less informative; one has to bring up the backtrace to understand the
> context.
>
> I could try my hand at an ERT explainer for these assertions.  Or we
> could just drop the 6th patch=E2=80=A6  I do find the tests easier to rea=
d and
> write with it though.

That's good enough for me,

--=20
Basil




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 23:32:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 19:32:32 2019
Received: from localhost ([127.0.0.1]:45577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrWAw-0004bK-Nd
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 19:32:31 -0400
Received: from mail-wr1-f65.google.com ([209.85.221.65]:45791)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hrWAt-0004b4-Nk
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 19:32:29 -0400
Received: by mail-wr1-f65.google.com with SMTP id f9so57925381wre.12
 for <35564 <at> debbugs.gnu.org>; Sat, 27 Jul 2019 16:32:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=nAA/Ln4pkw1b+xQEdR2SRFjwKo9QRWMzs/vt2eVrcLk=;
 b=QPmIFij0Du3dyqw+RPxCn5VtjEdjo6tUibkHw72R1j9YVSx8UYOgjXiD7+mP/L17iV
 PHw0TByXkoSabcnOLKoEtse1VDDNVhej5pASs/j1PJdrJhK3SXq6mTW5SQWhSTSetEWH
 dOT25fwAIKwOkmDPOsuT7l9H5OWBRalI0VAAnjq/68RYjD6EXgZpC6D244bQbdfhwmxC
 f3BDyBwbXT1s/GqyrZ7fITyTo+ZJX9p4hThBu/CDNKQh9RbeGjUXDah1YEZZimXuMbJn
 kX0YbRYDyGUjCZDtgAWAom+Mspp4CetCuRRAja4GFCHyuOt6Bw30i9h3SHQZQNub5hOH
 NtzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=nAA/Ln4pkw1b+xQEdR2SRFjwKo9QRWMzs/vt2eVrcLk=;
 b=SUS4LoTCfK8FCi0xdTpP/AzZRISgKRXTVXNV789Zb0iSfp3dzIIySqRxpMAvlCT54i
 M3SpEmXlhpKL27HjKOKRslzpAN5D874PYnmwCn9uemTLtuj5Vgv4fQphC8O1BEZUEvzU
 6OYhE1xvEOE5/BOSOxrqvxkLD0h1tEDpkfQJ2SKl+IFJSJJ7nvmha6klBRIdGBRokenp
 uShmeDPS4sChjDJP6rJ3SvOap3emvrH9yy/1ubL4WzVVxSM75Htg1sxJzdpDIB0R0lBF
 WZBMsp1YxSGrFK+uWKlY1zDxwgQc73u1jxxXR29DDunUBO7O8Qp8ECwWxbt6ev3xaXP+
 NGqw==
X-Gm-Message-State: APjAAAXbK3xNSAb5PJfT0F7ghdSqdPd7gz0WW1iFlQmr5GfCJ2mfY9f+
 rHboV5ghnRDRMAH7F2NVs8s=
X-Google-Smtp-Source: APXvYqy5hyEwsNrPLijfnKxSPDWYchpFu91TWsSjMNmP4lwbUeaBi28o6CFv/PVjd6DdLHx6kl4CmA==
X-Received: by 2002:adf:ce07:: with SMTP id p7mr30250649wrn.129.1564270341780; 
 Sat, 27 Jul 2019 16:32:21 -0700 (PDT)
Received: from nc10-laptop
 (2a01cb04010fc800c8771fb97d0446e3.ipv6.abo.wanadoo.fr.
 [2a01:cb04:10f:c800:c877:1fb9:7d04:46e3])
 by smtp.gmail.com with ESMTPSA id b15sm72882550wrt.77.2019.07.27.16.32.20
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 27 Jul 2019 16:32:20 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: "Basil L. Contovounesios" <contovob@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
 <87imrn16fk.fsf@HIDDEN>
Date: Sun, 28 Jul 2019 01:32:19 +0200
In-Reply-To: <87imrn16fk.fsf@HIDDEN> (Basil L. Contovounesios's message of
 "Sat, 27 Jul 2019 23:03:27 +0100")
Message-ID: <87lfwjoxz0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, 35564 <at> debbugs.gnu.org,
 monnier@HIDDEN, npostavs@HIDDEN
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: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

"Basil L. Contovounesios" <contovob@HIDDEN> writes:

>> -(defun dired--no-subst-prompt (char-positions command)
>> +(defun dired--mark-positions (positions)
>> +  (let ((markers (make-string
>> +                  (1+ (apply #'max positions))
>
> Is POSITIONS guaranteed to be non-nil?  (The max function takes at least
> one argument.)

AFAICT dired--mark-positions is only called by dired--no-subst-prompt,
which is only used when there is at least one ambiguous character to
highlight.

So as things stand now, POSITIONS will always be non-nil.  Nothing
prevents someone from attempting to re-use the function with a
potentially-nil argument though.

I don't know what makes more sense here: adding an assertion?  Handling
the nil case explicitly for robustness?

>> Subject: [PATCH 6/6] Simplify highlighting assertions
>>
>> * test/lisp/dired-aux-tests.el (dired-test--check-highlighting):
>> New function.
>> (dired-test-highlight-metachar): Use it.
>
> Will this simplification hinder debugging of test failures?  I don't
> have an opinion on the proposed change, it's just something to consider.

Mmm.  Since the assertion that fails is now nested in a more generic
function, the report shown in the ERT-Results buffer might be somewhat
less informative; one has to bring up the backtrace to understand the
context.

I could try my hand at an ERT explainer for these assertions.  Or we
could just drop the 6th patch=E2=80=A6  I do find the tests easier to read =
and
write with it though.


PS: Looking at this made me realize that patch #5 was borked (missed a
parenthesis in dired-test-highlight-metachar, so the tests just plain
wouldn't run).  Here is the patch series with patches #5 and #6 fixed.

The squashed patch[1] remains the same.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From f8f22404a6e0a46cd27149491df781d8c2c4cea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/6] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.

(Bug#35564)
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index eea4e045dd..0766530239 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2343,6 +2343,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2680,14 +2683,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From 047a2d355cbd167d93a1bbd25de64e2fb16fd815 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/6] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.

(Bug#35564)
---
 lisp/dired-aux.el            | 42 ++++++++++++++++++++++++++++++++----
 test/lisp/dired-aux-tests.el | 28 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 30a941c7bb..1e1ebf7552 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,42 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((start (max 0 (1- pos)))
+        (char (string (aref command pos))))
+    (and (string-match
+          (rx (or (seq (or bos blank)
+                       (group-n 1 (literal char))
+                       (or eos blank))
+                  (seq ?` (group-n 1 (literal char)) ?`)))
+          command start)
+         (= pos (match-beginning 1)))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -761,11 +797,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..80b6393931 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,34 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo `bar`?" 9))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0003-Dedup-dired-aux-isolated-char-searching-Bug-35564.patch

From 83497dc721d098ba089589ec2a5987a3b986c807 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@HIDDEN>
Date: Thu, 27 Jun 2019 19:15:56 -0400
Subject: [PATCH 3/6] Dedup dired-aux isolated char searching (Bug#35564)

* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to return
the first isolated match.
(dired--no-subst-prompt): Operate on a list of positions rather than
searching again for isolated chars.  Shorten prompt, and include the
character being asked about in the question (to make it clearer, and
in case the user can't see the fontification for whatever reason,
e.g., screen reader).
(dired--isolated-char-p): Remove.
(dired--need-confirm-positions): New function.
(dired-do-shell-command): Use it.
* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p): Remove.
(dired-test-highlight-metachar): Adjust to new functions.  Make sure
that `*` isn't considered isolated.
---
 lisp/dired-aux.el            | 113 ++++++++++++++++-------------------
 test/lisp/dired-aux-tests.el |  31 +++++-----
 2 files changed, 67 insertions(+), 77 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 1e1ebf7552..ca5b8cf801 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -60,60 +60,60 @@ dired-isolated-string-re
 of a string followed/prefixed with an space.
 The regexp capture the preceding blank, STRING and the following blank as
 the groups 1, 2 and 3 respectively."
-  (format "\\(\\`\\|[ \t]\\)\\(%s\\)\\([ \t]\\|\\'\\)" string))
+  (format "\\(?1:\\`\\|[ \t]\\)\\(?2:%s\\)\\(?3:[ \t]\\|\\'\\)" string))
 
-(defun dired--star-or-qmark-p (string match &optional keep)
+(defun dired--star-or-qmark-p (string match &optional keep start)
   "Return non-nil if STRING contains isolated MATCH or `\\=`?\\=`'.
 MATCH should be the strings \"?\", `\\=`?\\=`', \"*\" or nil.  The latter
 means STRING contains either \"?\" or `\\=`?\\=`' or \"*\".
 If optional arg KEEP is non-nil, then preserve the match data.  Otherwise,
 this function changes it and saves MATCH as the second match group.
+START is the position to start matching from.
 
 Isolated means that MATCH is surrounded by spaces or at the beginning/end
 of STRING followed/prefixed with an space.  A match to `\\=`?\\=`',
 isolated or not, is also valid."
-  (let ((regexps (list (dired-isolated-string-re (if match (regexp-quote match) "[*?]")))))
+  (let ((regexp (dired-isolated-string-re (if match (regexp-quote match) "[*?]"))))
     (when (or (null match) (equal match "?"))
-      (setq regexps (append (list "\\(\\)\\(`\\?`\\)\\(\\)") regexps)))
-    (cl-some (lambda (x)
-               (funcall (if keep #'string-match-p #'string-match) x string))
-             regexps)))
-
-(defun dired--isolated-char-p (command pos)
-  "Assert whether the character at POS is isolated within COMMAND.
-A character is isolated if:
-- it is surrounded by whitespace, the start of the command, or
-  the end of the command,
-- it is surrounded by `\\=`' characters."
-  (let ((start (max 0 (1- pos)))
-        (char (string (aref command pos))))
-    (and (string-match
-          (rx (or (seq (or bos blank)
-                       (group-n 1 (literal char))
-                       (or eos blank))
-                  (seq ?` (group-n 1 (literal char)) ?`)))
-          command start)
-         (= pos (match-beginning 1)))))
-
-(defun dired--highlight-nosubst-char (command char)
-  "Highlight occurences of CHAR that are not isolated in COMMAND.
-These occurences will not be substituted; they will be sent as-is
-to the shell, which may interpret them as wildcards."
-  (save-match-data
-    (let ((highlighted (substring-no-properties command))
-          (pos 0))
-      (while (string-match (regexp-quote char) command pos)
-        (let ((start (match-beginning 0))
-              (end (match-end 0)))
-          (unless (dired--isolated-char-p command start)
-            (add-face-text-property start end 'warning nil highlighted))
-          (setq pos end)))
-      highlighted)))
-
-(defun dired--no-subst-prompt (command char)
-  (let ((highlighted-command (dired--highlight-nosubst-char command char))
-        (prompt "Confirm--the highlighted characters will not be substituted:"))
-    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+      (cl-callf concat regexp "\\|\\(?1:\\)\\(?2:`\\?`\\)\\(?3:\\)"))
+    (funcall (if keep #'string-match-p #'string-match) regexp string start)))
+
+(defun dired--need-confirm-positions (command string)
+  "Search for non-isolated matches of STRING in COMMAND.
+Return a list of positions that match STRING, but would not be
+considered \"isolated\" by `dired--star-or-qmark-p'."
+  (cl-assert (= (length string) 1))
+  (let ((start 0)
+        (isolated-char-positions nil)
+        (confirm-positions nil)
+        (regexp (regexp-quote string)))
+    ;; Collect all ? and * surrounded by spaces and `?`.
+    (while (dired--star-or-qmark-p command string nil start)
+      (push (cons (match-beginning 2) (match-end 2))
+            isolated-char-positions)
+      (setq start (match-end 2)))
+    ;; Now collect any remaining ? and *.
+    (setq start 0)
+    (while (string-match regexp command start)
+      (unless (cl-member (match-beginning 0) isolated-char-positions
+                         :test (lambda (pos match)
+                                 (<= (car match) pos (cdr match))))
+        (push (match-beginning 0) confirm-positions))
+      (setq start (match-end 0)))
+    confirm-positions))
+
+(defun dired--no-subst-prompt (char-positions command)
+  (cl-callf substring-no-properties command)
+  (dolist (pos char-positions)
+    (add-face-text-property pos (1+ pos) 'warning nil command))
+  (concat command "\n"
+          (format-message
+           (ngettext "Send %d occurence of `%s' as-is to shell?"
+                     "Send %d occurences of `%s' as-is to shell?"
+                     (length char-positions))
+           (length char-positions)
+           (propertize (string (aref command (car char-positions)))
+                       'face 'warning))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -781,26 +781,19 @@ dired-do-shell-command
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
       files)))
-  (cl-flet ((need-confirm-p
-             (cmd str)
-             (let ((res cmd)
-                   (regexp (regexp-quote str)))
-               ;; Drop all ? and * surrounded by spaces and `?`.
-               (while (and (string-match regexp res)
-                           (dired--star-or-qmark-p res str))
-                 (setq res (replace-match "" t t res 2)))
-               (string-match regexp res))))
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
+         (confirmations nil)
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
-         (ok (cond ((not (or on-each no-subst))
-	            (error "You can not combine `*' and `?' substitution marks"))
-	           ((need-confirm-p command "*")
-	            (y-or-n-p (dired--no-subst-prompt command "*")))
-	           ((need-confirm-p command "?")
-	            (y-or-n-p (dired--no-subst-prompt command "?")))
-	           (t))))
+         (ok (cond
+              ((not (or on-each no-subst))
+               (error "You can not combine `*' and `?' substitution marks"))
+              ((setq confirmations (dired--need-confirm-positions command "*"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              ((setq confirmations (dired--need-confirm-positions command "?"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
            (if on-each
@@ -811,7 +804,7 @@ dired-do-shell-command
 	                          nil file-list)
 	     ;; execute the shell command
 	     (dired-run-shell-command
-	      (dired-shell-stuff-it command file-list nil arg))))))))
+              (dired-shell-stuff-it command file-list nil arg)))))))
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 80b6393931..3f4bfffaf6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,34 +114,31 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
-(ert-deftest dired-test-isolated-char-p ()
-  (should (dired--isolated-char-p "?" 0))
-  (should (dired--isolated-char-p "? " 0))
-  (should (dired--isolated-char-p " ?" 1))
-  (should (dired--isolated-char-p " ? " 1))
-  (should (dired--isolated-char-p "foo bar ? baz" 8))
-  (should (dired--isolated-char-p "foo -i`?`" 7))
-  (should-not (dired--isolated-char-p "foo `bar`?" 9))
-  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
-  (should-not (dired--isolated-char-p "foo bar?baz" 7))
-  (should-not (dired--isolated-char-p "foo bar?" 7)))
-
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
-         (result (dired--highlight-nosubst-char command "?")))
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "?")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
     (should-not (text-property-not-all 30 39 'face nil result)))
-  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
-         (result (dired--highlight-nosubst-char command "*")))
+  ;; Note that `?` is considered isolated, but `*` is not.
+  (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "*")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 24 'face result)))
-    (should-not (text-property-not-all 25 29 'face nil result))))
+    (should (equal 'warning (get-text-property 25 'face result)))
+    (should-not (text-property-not-all 26 32 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0004-fixup-Dedup-dired-aux-isolated-char-searching-Bug-35.patch

From 612e77f1cd0163c383a20b4401bfcf5e299b0aa6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:29:38 +0200
Subject: [PATCH 4/6] fixup! Dedup dired-aux isolated char searching
 (Bug#35564)

---
 lisp/dired-aux.el            | 4 ++--
 test/lisp/dired-aux-tests.el | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index ca5b8cf801..b15a9426dc 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -108,8 +108,8 @@ dired--no-subst-prompt
     (add-face-text-property pos (1+ pos) 'warning nil command))
   (concat command "\n"
           (format-message
-           (ngettext "Send %d occurence of `%s' as-is to shell?"
-                     "Send %d occurences of `%s' as-is to shell?"
+           (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                     "Send %d occurrences of `%s' as-is to shell?"
                      (length char-positions))
            (length char-positions)
            (propertize (string (aref command (car char-positions)))
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 3f4bfffaf6..ff18edddb6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -118,8 +118,8 @@ dired-test-highlight-metachar
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "?")))
+                  (dired--need-confirm-positions command "?")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
@@ -130,8 +130,8 @@ dired-test-highlight-metachar
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "*")))
+                  (dired--need-confirm-positions command "*")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0005-Add-markers-below-non-isolated-chars-in-dired-prompt.patch

From 9ba62e66fcdbba8305821acf690f263e9ccf10a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:17:57 +0200
Subject: [PATCH 5/6] Add '^' markers below non-isolated chars in dired prompt

* lisp/dired-aux.el (dired--mark-positions): New function.
(dired--no-subst-prompt): Use it to show chars without overly
relying on highlighting.
(dired-do-shell-command): When the echo area is wide enough to
display the command without wrapping it, add the markers.

* test/lisp/dired-aux-tests.el (dired-test-highlight-metachar):
Add assertion for '^' marker positions.

(Bug#35564)
---
 lisp/dired-aux.el            | 43 +++++++++++++++++++++--------
 test/lisp/dired-aux-tests.el | 53 ++++++++++++++++++++++++------------
 2 files changed, 68 insertions(+), 28 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index b15a9426dc..3887d75356 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -102,18 +102,35 @@ dired--need-confirm-positions
       (setq start (match-end 0)))
     confirm-positions))
 
-(defun dired--no-subst-prompt (char-positions command)
+(defun dired--mark-positions (positions)
+  (let ((markers (make-string
+                  (1+ (apply #'max positions))
+                  ?\s)))
+    (dolist (pos positions)
+      (setf (aref markers pos) ?^))
+    markers))
+
+(defun dired--no-subst-prompt (char-positions command add-markers)
   (cl-callf substring-no-properties command)
   (dolist (pos char-positions)
     (add-face-text-property pos (1+ pos) 'warning nil command))
-  (concat command "\n"
-          (format-message
-           (ngettext "Send %d occurrence of `%s' as-is to shell?"
-                     "Send %d occurrences of `%s' as-is to shell?"
-                     (length char-positions))
-           (length char-positions)
-           (propertize (string (aref command (car char-positions)))
-                       'face 'warning))))
+  ;; `y-or-n-p' adds some text to the beginning of the prompt when the
+  ;; user fails to answer 'y' or 'n'.  The highlighted command thus
+  ;; cannot be put on the first line of the prompt, since the added
+  ;; text will shove the command to the right, and the '^' markers
+  ;; will become misaligned.
+  (apply #'concat
+         `("Confirm:\n"
+           ,command "\n"
+           ,@(when add-markers
+               (list (dired--mark-positions char-positions) "\n"))
+           ,(format-message
+             (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                       "Send %d occurrences of `%s' as-is to shell?"
+                       (length char-positions))
+             (length char-positions)
+             (propertize (string (aref command (car char-positions)))
+                         'face 'warning)))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -784,15 +801,19 @@ dired-do-shell-command
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
          (confirmations nil)
+         (short-enough (< (length command)
+                          (window-width (minibuffer-window))))
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
          (ok (cond
               ((not (or on-each no-subst))
                (error "You can not combine `*' and `?' substitution marks"))
               ((setq confirmations (dired--need-confirm-positions command "*"))
-               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+               (y-or-n-p (dired--no-subst-prompt confirmations command
+                                                 short-enough)))
               ((setq confirmations (dired--need-confirm-positions command "?"))
-               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+               (y-or-n-p (dired--no-subst-prompt confirmations command
+                                                 short-enough)))
               (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ff18edddb6..174c27052e 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -115,30 +115,49 @@ dired-test-bug30624
         (kill-buffer buf)))))
 
 (ert-deftest dired-test-highlight-metachar ()
-  "Check that non-isolated meta-characters are highlighted"
+  "Check that non-isolated meta-characters are highlighted."
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (markers "               ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "?")
-                  command))
-         (result (and (string-match (regexp-quote command) prompt)
-                      (match-string 0 prompt))))
-    (should-not (text-property-not-all 1 14 'face nil result))
-    (should (equal 'warning (get-text-property 15 'face result)))
-    (should-not (text-property-not-all 16 28 'face nil result))
-    (should (equal 'warning (get-text-property 29 'face result)))
-    (should-not (text-property-not-all 30 39 'face nil result)))
+                  command
+                  t))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 4))
+    (should (string-match (regexp-quote command) highlit-command))
+    (should (string-match (regexp-quote markers) (nth 2 lines)))
+    (should-not (text-property-not-all 1 14 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 15 'face highlit-command)))
+    (should-not (text-property-not-all 16 28 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 29 'face highlit-command)))
+    (should-not (text-property-not-all 30 39 'face nil highlit-command)))
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (markers "           ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "*")
-                  command))
-         (result (and (string-match (regexp-quote command) prompt)
-                      (match-string 0 prompt))))
-    (should-not (text-property-not-all 1 10 'face nil result))
-    (should (equal 'warning (get-text-property 11 'face result)))
-    (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 25 'face result)))
-    (should-not (text-property-not-all 26 32 'face nil result))))
+                  command
+                  t))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 4))
+    (should (string-match (regexp-quote command) highlit-command))
+    (should (string-match (regexp-quote markers) (nth 2 lines)))
+    (should-not (text-property-not-all 1 10 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 11 'face highlit-command)))
+    (should-not (text-property-not-all 12 23 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 25 'face highlit-command)))
+    (should-not (text-property-not-all 26 32 'face nil highlit-command)))
+  (let* ((command "sed 's/\\?/!/'")
+         (prompt (dired--no-subst-prompt
+                  (dired--need-confirm-positions command "?")
+                  command
+                  nil))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 3))
+    (should (string-match (regexp-quote command) highlit-command))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0006-Simplify-highlighting-assertions.patch

From c5729141cda2131a4c72f268bfacf36b6ebca47c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 12 Jul 2019 16:10:54 +0200
Subject: [PATCH 6/6] Simplify highlighting assertions

* test/lisp/dired-aux-tests.el (dired-test--check-highlighting):
New function.
(dired-test-highlight-metachar): Use it.

(Bug#35564)
---
 test/lisp/dired-aux-tests.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 174c27052e..ba10c54332 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,15 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(defun dired-test--check-highlighting (command positions)
+  (let ((start 1))
+    (dolist (pos positions)
+      (should-not (text-property-not-all start (1- pos) 'face nil command))
+      (should (equal 'warning (get-text-property pos 'face command)))
+      (setq start (1+ pos)))
+    (should-not (text-property-not-all
+                 start (length command) 'face nil command))))
+
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted."
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
@@ -127,11 +136,7 @@ dired-test-highlight-metachar
     (should (= (length lines) 4))
     (should (string-match (regexp-quote command) highlit-command))
     (should (string-match (regexp-quote markers) (nth 2 lines)))
-    (should-not (text-property-not-all 1 14 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 15 'face highlit-command)))
-    (should-not (text-property-not-all 16 28 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 29 'face highlit-command)))
-    (should-not (text-property-not-all 30 39 'face nil highlit-command)))
+    (dired-test--check-highlighting highlit-command '(15 29)))
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
          (markers "           ^             ^")
@@ -144,11 +149,7 @@ dired-test-highlight-metachar
     (should (= (length lines) 4))
     (should (string-match (regexp-quote command) highlit-command))
     (should (string-match (regexp-quote markers) (nth 2 lines)))
-    (should-not (text-property-not-all 1 10 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 11 'face highlit-command)))
-    (should-not (text-property-not-all 12 23 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 25 'face highlit-command)))
-    (should-not (text-property-not-all 26 32 'face nil highlit-command)))
+    (dired-test--check-highlighting highlit-command '(11 25)))
   (let* ((command "sed 's/\\?/!/'")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "?")
@@ -157,7 +158,8 @@ dired-test-highlight-metachar
          (lines (split-string prompt "\n"))
          (highlit-command (nth 1 lines)))
     (should (= (length lines) 3))
-    (should (string-match (regexp-quote command) highlit-command))))
+    (should (string-match (regexp-quote command) highlit-command))
+    (dired-test--check-highlighting highlit-command '(8))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/plain


Thank you for your review.


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28969#19

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 22:23:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 18:23:08 2019
Received: from localhost ([127.0.0.1]:45537 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrV5o-0002op-BP
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 18:23:08 -0400
Received: from mout.web.de ([212.227.15.3]:56731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hrV5n-0002oN-A5
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 18:23:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1564266166;
 bh=OS7LlJ2m4qfpcc7zfhiD7GRgAE1hYLlUIuPsUV67k5c=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=RxT8lq6zgpVTluTGiLNW2IKP3fzFKl3LvCue2wPwfP1QZGffCeq5RBvMZZVpm9RFR
 ti/ikyZ5TVR2RJMgJqM9eLysxCwk+tj8q3WP/RPUyq5kfKzrVQjaQ+hFfXVWENc7rN
 nyTD13ZjM3heQFa02Wwd1nLGSWQ8EO99CUE2EKIM=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([92.208.178.242]) by smtp.web.de (mrweb003
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LmLac-1iR6km1czi-00Zx7z; Sun, 28
 Jul 2019 00:22:46 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
 <87wog3pewu.fsf@HIDDEN>
Date: Sun, 28 Jul 2019 00:22:40 +0200
In-Reply-To: <87wog3pewu.fsf@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Sat, 27 Jul 2019 19:26:25 +0200")
Message-ID: <87v9vndsnj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:QVOz8vMhh2O4MMYrcDv81Y7MoqR3qu77PLn/nr0ReksnC5KG5Y7
 9sCGyDmXH/insQtPnnDSCZSxFF00CpHnISW1SpGIooJqq5M6vCNmfmaosWH/sHjlrVNrIbg
 H7nrgVxk93qdwUet7XJNbTgypvPp4cVikZ1KcoL/eXRLefVn5pYGRxm9D9rAUK+tF4aJUvH
 hi43Mw8zYyXZ6Xe4MpVFw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:u8uVTMYUUZU=:d8SSbOza89mL9jUPQRrfEv
 3P+OhpBE66DZXVTR4Ug/z5djvUVi1LvOB9ksCVe303shGyRXAkK2Vtx8P2jZPPPzMrbQPoUk+
 7KuGwGbGj/GXoZTqblP9SrHK10l/4jkM9Zy1DRk5RotO1YvsQlXagEvu1J3qJ3QYL4+5ZZm4S
 Q/OPU7D4+3qlPM5fy3C0aU4mwBLk9d3Zzx9oXyXYw37jVbNl74g9rDzjLHL84O7eVtpYLgw71
 2QuuhBei6+QPvwKkqNzYWJqsh/gYJ1llhYamELNXsq0MH942bfh4LfNwVapqP5T4SSu+Ovj0D
 J/4XkEb1/IkbIq4+5WCQRg0XSwE5c67jYw6jF2X0aanwJYop7S0say56Yyt2j0qsPTZBPPymh
 VjoA/EWD6OHodlW24ygNuYt553Id+umZSlG6acs4uD6KtgQpoyhvVY/gpH7LxWvIvTuLRpFmn
 4gUjzGg1Db636SurKR2cuw3Y31imqbwsxgGq1mWg6nnGkj1LvrCFF0y6tf0x8nkA27uO2vgo1
 uDOXkfiHZBfLCvi8FTrXCE2CZ2WvUKW6+ETytVo+fT4t8OqAEF6fyJDNajMJzDviQMj8GYdmg
 21OmyyqNnQZkB4OnUeQxOfYvre8Q5XbdiHvRkbP2Yz4mUZ99aa1/7kZUm85PK/OqhIlzqZbMU
 zhj8T9MI2JiZaAm9X4R/YbnIaQiBBSmVrk/dgNntdBT4Mb0mZ5oPfozbfcUeeRdJ46gTaHJ5c
 c0spvb8/JpPXZybbdWeOlq77V77zyWCT9rAv2sfkawghSh3OJoLMa32VhBPogTmh2uY+UbV0D
 MEgHdjiyRc4IBocu+c59xdKSubqgJCtv0V+hzIWzqgfLrFwIbbHw6yvaHTEwExMHQvmXTLRJO
 rXJTmU+3GfvVUKzZ7optIjJyNRK7P+OXyiHbvnyqs+PefVZ6cPtBjGe/DljIzIPuEcZef87kO
 oS4NpR2+k7bf2pySZz1U7o6AqtCj1IMPSecEpwgHwZD5B3m0GKxT5QuDzxi91KtnQfqaQ8o+s
 pNRKXhg5G8xO2ATcHsntBuXjA8jpw1+BCibbot4vjwciZ4rYWu5+Q0FY5xdQ+mY4LNoirPOxy
 OynueRUojVWZzil/nXYMRhuBSIPNEkeZ9o+
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, 35564 <at> debbugs.gnu.org,
 monnier@HIDDEN, npostavs@HIDDEN
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: -1.0 (-)

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> Michael, did you get the chance to try the patch out?

I skimmed through the changes and have installed it, but I didn't yet
try it.  Will do ASAP, hopefully tonight.

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 22:03:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 18:03:37 2019
Received: from localhost ([127.0.0.1]:45528 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrUmv-0002K6-B0
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 18:03:37 -0400
Received: from mail-wr1-f42.google.com ([209.85.221.42]:35564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1hrUmt-0002Jr-6F
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 18:03:35 -0400
Received: by mail-wr1-f42.google.com with SMTP id y4so57888739wrm.2
 for <35564 <at> debbugs.gnu.org>; Sat, 27 Jul 2019 15:03:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=tcd-ie.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=OmlGYtC7hF9thftNtcwEbyLaAkL3m5QM4ohsFra/T0E=;
 b=Ca4bQ7/v0YH+rX7GLxlWBR0fEnfW07Td5865WyfNOXlUxp8iYBY8GDj4br/zJsSU+e
 lemGtb/al6WngoiNOQP7Q0r4ImZRM1x9leXkXLg2bHjs2p6o2pJCMk8rHI/Ba2stTvoX
 OS6Y7tLvUBBU3vG7XfsunrwlXls2Vw4D5NJEAJvMgJHYwCtm+0dMRo8deOMHz6k34Scb
 GpdAVp/PYPHjSRTzZbO1Y1BeoGuUijrBmpkN9H5oQfvPKgsVaLCAKolbyW0IHEVGm8iP
 xzLTbWWymEal13LaaWeewo4oEG23Jpff6fRbk4iWfJv/DOm+X5Fkm5gfDQQcgqNctY8p
 lzmg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=OmlGYtC7hF9thftNtcwEbyLaAkL3m5QM4ohsFra/T0E=;
 b=kLtAip63zcJKFNGv7sHUlj3Af8wavv4OVB1X0eCIOrxksBD55Ux31YcLN3P3AJvt4a
 kyI1I4qp37lJOG/ig21S2Zemg3M0UwIe3ZAhbujEclrc03AjMJQeQDYO2LUaJt63hs9+
 yKcPzgVdBVhhM8eXjSAzS+mtvTMQkUz7y/+792HS9Y7Fo8NbI/i/GfvkhtJPHxMHijwh
 8ShYhxP6UUJ6v1EvGGKQ15dGP8NxSExdS4+oTF5fsA+fHh7LYNfJ+VHR+nlhfvlLLimp
 nUg9EFzYEnj4uN/NiTZFGHcP07+9h1ld/NVkWJOt0Rhyd//+mk8j09utRxJpKUwvb4q6
 q/VA==
X-Gm-Message-State: APjAAAWa1oQxwIOp2KQl8/b7d7c+owsgn34Y/GxSMDcMbAXycK6sAGY3
 I6rOHYnGExyP22fJs/prm81COw==
X-Google-Smtp-Source: APXvYqxGru7mDzqf28He2x0Mg5x14UOju1tE512jOBMUsOJ/V6bc74k1cgvwjvBci42346/8vRo9qw==
X-Received: by 2002:a5d:4f01:: with SMTP id c1mr28763092wru.43.1564265009374; 
 Sat, 27 Jul 2019 15:03:29 -0700 (PDT)
Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2])
 by smtp.gmail.com with ESMTPSA id f192sm60235819wmg.30.2019.07.27.15.03.28
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sat, 27 Jul 2019 15:03:28 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
Date: Sat, 27 Jul 2019 23:03:27 +0100
In-Reply-To: <83wog3lo5c.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 27 Jul
 2019 14:20:31 +0300")
Message-ID: <87imrn16fk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: npostavs@HIDDEN, 35564 <at> debbugs.gnu.org, monnier@HIDDEN,
 =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> Any more comments, anyone?

Just a couple of very minor questions from me:

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> -(defun dired--no-subst-prompt (char-positions command)
> +(defun dired--mark-positions (positions)
> +  (let ((markers (make-string
> +                  (1+ (apply #'max positions))

Is POSITIONS guaranteed to be non-nil?  (The max function takes at least
one argument.)

> Subject: [PATCH 6/6] Simplify highlighting assertions
>
> * test/lisp/dired-aux-tests.el (dired-test--check-highlighting):
> New function.
> (dired-test-highlight-metachar): Use it.

Will this simplification hinder debugging of test failures?  I don't
have an opinion on the proposed change, it's just something to consider.

> Again, thank you for your patience and your reviews.

Thank you for working on this,

--=20
Basil




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 17:26:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 13:26:37 2019
Received: from localhost ([127.0.0.1]:45376 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrQSq-0006eG-Lh
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 13:26:36 -0400
Received: from mail-wr1-f68.google.com ([209.85.221.68]:32881)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hrQSm-0006dy-To
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 13:26:35 -0400
Received: by mail-wr1-f68.google.com with SMTP id n9so57616942wru.0
 for <35564 <at> debbugs.gnu.org>; Sat, 27 Jul 2019 10:26:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=G1gCwtMQmx9wibDYGZ7I2a8UWycoXunib42GtqBF54c=;
 b=irxCMfrkbSz6bJhBa4m1YrHvgQoiptD8FG3s43ulakskW6mXRqKzbJABMieB6A0QDA
 CH5D/XcH7hh/mVEDVEcDLZwUN0lrl28CITHd3Vta8BJeF6lLzGH2/FKrjiEm3XFPcbn/
 UtwGnZ7U33kJHJW9afOdUsYyO1m8Kt15bS0XvC/BdgZN5rgpEp1noKnN7vSRHXXIDCeG
 UgTFiMAw+NU4VrykzsGAZoX2RvbFYRc8uzfasnTh3j+4n9ruMrELgeE5hoCSYLaMTw0+
 v8wvCMZKYjR7Qswx6OztOKKRF/NlHfl+i9L6ixsko7dXMY6gQjg9+kelM2PbTX3ftyhb
 xWQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=G1gCwtMQmx9wibDYGZ7I2a8UWycoXunib42GtqBF54c=;
 b=ZTtAT4C/27P8bKwGr2JDlBUvOOX2//6R5xYqs3Pxx9Vz1CDvosCWCMyzzCf5+5UgMb
 AOHl2zC3kmAnwV6+h0uNvLJ//chYQomO83EZtbrxme66CZzCFU8eKYaYOHD2RUTkWbaG
 CSbmVHD9GeftUwYygEL2O/4wEfPzYhkiNapPB0AHgIlrkvkqgQ5Y/BrVsDBzoc9LEUMV
 ucFBrj5R5hLslhj5bXT0HEVZ8w6unrYlwBPK607ApHVuxnPTbsOaw7FMso/1gRzITDDV
 OeuoAjH7l8Ag2f2Y0wmR9t75sORHE9Ke3N6x8HTjMRhc25XbPNew5LV37/fGByyl3KWB
 nMNQ==
X-Gm-Message-State: APjAAAWlcMv5087YvYw6eFZi7a3I/Eh+BVEnSwqCPyRqpmWLtPsMv2LZ
 0xjjQ3suKZmGwiCgVUCp4k4=
X-Google-Smtp-Source: APXvYqyfFDHZp2wipe/97mdC8rmLQaqtKavDWXto1hR7bCrNoahxQXnraduedZM2hnf89TvXEV5QBQ==
X-Received: by 2002:adf:e790:: with SMTP id n16mr92005107wrm.120.1564248387148; 
 Sat, 27 Jul 2019 10:26:27 -0700 (PDT)
Received: from nc10-laptop
 (2a01cb04010fc800c8771fb97d0446e3.ipv6.abo.wanadoo.fr.
 [2a01:cb04:10f:c800:c877:1fb9:7d04:46e3])
 by smtp.gmail.com with ESMTPSA id g10sm40992829wrw.60.2019.07.27.10.26.25
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 27 Jul 2019 10:26:26 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN> <83wog3lo5c.fsf@HIDDEN>
Date: Sat, 27 Jul 2019 19:26:25 +0200
In-Reply-To: <83wog3lo5c.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 27 Jul
 2019 14:20:31 +0300")
Message-ID: <87wog3pewu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: michael_heerdegen@HIDDEN, 35564 <at> debbugs.gnu.org, monnier@HIDDEN,
 drew.adams@HIDDEN, npostavs@HIDDEN
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN>
>> Cc: Eli Zaretskii <eliz@HIDDEN>,  Stefan Monnier
>>  <monnier@HIDDEN>,  Drew Adams <drew.adams@HIDDEN>,  Noam
>>  Postavsky <npostavs@HIDDEN>
>> Date: Fri, 12 Jul 2019 17:10:26 +0200
>>=20
>> I have now added '^' markers below the highlighted command, on condition
>> that the echo area is wide enough not to wrap lines.
>>=20
>> Do we want to add some customizability (highlight face, whether or not
>> to display '^' markers), or is this good enough for now?
>>=20
>>=20
>> The patch series now includes:
>>=20
>> - two patches to make y-or-n-p preserve text properties and implement an
>>   initial version of highlighting,
>> - Noam's refactoring patch, plus fixups,
>> - one patch to add '^' markers,
>> - one last patch to make tests less tedious to maintain.
>
> Any more comments, anyone?

Michael had some comments over at bug#28969, but no objections AFAICT.

Michael, did you get the chance to try the patch out?


> Is there anything in these changes that would warrant a NEWS entry?

The changes are only cosmetic: the user interaction has not changed
(tell Dired to run a command, press 'y' to confirm).  The prompt is
simply more verbose now.

There are no new variables for the user to customize either, if I am not
mistaken.


NB: I squashed all those patches in [2], to make it easier to try the
new prompt out.  The squashed patch's commit message summarizes every
change, and mentions both bugs; I don't know if it makes more sense to
commit the series or the squashed patch to the repository.


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28969#22
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28969#19




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jul 2019 11:20:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 27 07:20:54 2019
Received: from localhost ([127.0.0.1]:43716 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrKkw-0003TC-62
	for submit <at> debbugs.gnu.org; Sat, 27 Jul 2019 07:20:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51033)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hrKku-0003T0-NE
 for 35564 <at> debbugs.gnu.org; Sat, 27 Jul 2019 07:20:52 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:38864)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hrKkl-0006Iu-0H; Sat, 27 Jul 2019 07:20:44 -0400
Received: from [176.228.60.248] (port=4098 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1hrKkh-00074P-W8; Sat, 27 Jul 2019 07:20:42 -0400
Date: Sat, 27 Jul 2019 14:20:31 +0300
Message-Id: <83wog3lo5c.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?iso-8859-1?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
In-reply-to: <87y313z3tp.fsf@HIDDEN> (message from =?iso-8859-1?Q?K=E9v?=
 =?iso-8859-1?Q?in?= Le Gouguec on Fri, 12 Jul 2019 17:10:26 +0200)
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
 <87y313z3tp.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, monnier@HIDDEN, drew.adams@HIDDEN,
 npostavs@HIDDEN
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: -3.3 (---)

> From: Kvin Le Gouguec <kevin.legouguec@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>,  Stefan Monnier
>  <monnier@HIDDEN>,  Drew Adams <drew.adams@HIDDEN>,  Noam
>  Postavsky <npostavs@HIDDEN>
> Date: Fri, 12 Jul 2019 17:10:26 +0200
> 
> I have now added '^' markers below the highlighted command, on condition
> that the echo area is wide enough not to wrap lines.
> 
> Do we want to add some customizability (highlight face, whether or not
> to display '^' markers), or is this good enough for now?
> 
> 
> The patch series now includes:
> 
> - two patches to make y-or-n-p preserve text properties and implement an
>   initial version of highlighting,
> - Noam's refactoring patch, plus fixups,
> - one patch to add '^' markers,
> - one last patch to make tests less tedious to maintain.

Any more comments, anyone?

Is there anything in these changes that would warrant a NEWS entry?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.
Merged 28969 35564. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 12 Jul 2019 15:10:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 12 11:10:40 2019
Received: from localhost ([127.0.0.1]:40551 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hlxC2-0002cY-Jw
	for submit <at> debbugs.gnu.org; Fri, 12 Jul 2019 11:10:40 -0400
Received: from mail-wr1-f54.google.com ([209.85.221.54]:33931)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hlxBz-0002cK-RC
 for 35564 <at> debbugs.gnu.org; Fri, 12 Jul 2019 11:10:37 -0400
Received: by mail-wr1-f54.google.com with SMTP id 31so10378345wrm.1
 for <35564 <at> debbugs.gnu.org>; Fri, 12 Jul 2019 08:10:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=8Dp3aRDzVK/VQ7aqInmPEGQkMWSgduvHehyBHhxEbgw=;
 b=ki/rpzNCFRS1jRp4EYJPNGYnwh6d18cxg58mOf7Kip8jMQFuRcZkKyw677nM8RFzfM
 X80J65ujHcHR1YnFtiqT403b9HydXsHKvjzoVWXmCn6RAZSLFnzWRCNCnaZx1/LZm+eG
 CBCG4DCep8GPpAKWGGsUp/WnA6lJ9PeYppHSl2+jns1TrzwThBOeCUaP3K8JqytNWHMX
 Lk3oNOwBO34hJRAl2jkLX/gR5VPFPi5lWRQWZDxd6HibkiOxenKegYxtDS4xfXbBzGki
 wQjyLtN1aSRDyeOZ+KqWrpY0mAFvPD3oZqKAxlLbAYX2V/tOIZXMCa2aYQSlsbJ/IJIj
 JoUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=8Dp3aRDzVK/VQ7aqInmPEGQkMWSgduvHehyBHhxEbgw=;
 b=L7wWF0hoFEMnePPp8ApK7p9knMh2WoF9Bh1xiWtXIhpkK+ffpnSdrlwl/+6i6CP3cX
 F0QI05WEBB4slp2i2LEKIyijB1s2kuMDSHaeM5p80O1pvXf2DYBHqmwCG82GDbw/iZja
 oKtHvdFhiZGSYTxwO+/q6hVHb9jXIYYIaFksyPVwhSnl+Zud6IvMfxVh+Dd5LOH7Tkte
 HEiUIJo7mg7sQHvt1hmLAeTeMA/ByOYWhfo1Y7OrtDvpHgiAMzkfBTpLfkpeluZLq96A
 QbWRcpZYscDykD5mzwuU2ESEm8dZEdhxeWynmiRRp/35DTIKiC+geRr79cCOPYYK8qqT
 l2yg==
X-Gm-Message-State: APjAAAX8KIUNtxtVw0Z3REbXktT1T34RaNVN7NANwy2endF3MQUoDD7M
 DQtzhQXQYhGCdPErN2ewhHA=
X-Google-Smtp-Source: APXvYqypcHQNVThzi814L7cvYAzVnSd62ynk86Cx5kd2LT3+aHZmRpM92hlVU3HVGxvpJqiqJTZY/w==
X-Received: by 2002:adf:90e7:: with SMTP id i94mr11499889wri.224.1562944229980; 
 Fri, 12 Jul 2019 08:10:29 -0700 (PDT)
Received: from nc10-laptop ([80.12.63.125])
 by smtp.gmail.com with ESMTPSA id m7sm7021801wrx.65.2019.07.12.08.10.27
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 12 Jul 2019 08:10:28 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: 35564 <at> debbugs.gnu.org
Subject: Re: bug#35564: [PATCH v4] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87imsinbmr.fsf_-_@HIDDEN>
Date: Fri, 12 Jul 2019 17:10:26 +0200
In-Reply-To: <87imsinbmr.fsf_-_@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Wed, 03 Jul 2019 21:47:40 +0200")
Message-ID: <87y313z3tp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 Drew Adams <drew.adams@HIDDEN>, Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain

Hello,

I have now added '^' markers below the highlighted command, on condition
that the echo area is wide enough not to wrap lines.

Do we want to add some customizability (highlight face, whether or not
to display '^' markers), or is this good enough for now?


The patch series now includes:

- two patches to make y-or-n-p preserve text properties and implement an
  initial version of highlighting,
- Noam's refactoring patch, plus fixups,
- one patch to add '^' markers,
- one last patch to make tests less tedious to maintain.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From fbd41865515e13e35874e98a8847e1a67a9b956c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/6] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.

(Bug#35564)
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 4a1649f601..c59f13b24c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2338,6 +2338,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2675,14 +2678,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From 802f14e186de7a8cf540b8d8c04155da1d983731 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/6] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.

(Bug#35564)
---
 lisp/dired-aux.el            | 42 ++++++++++++++++++++++++++++++++----
 test/lisp/dired-aux-tests.el | 28 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d83e57d58d..d184598b92 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,42 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((start (max 0 (1- pos)))
+        (char (string (aref command pos))))
+    (and (string-match
+          (rx (or (seq (or bos blank)
+                       (group-n 1 (literal char))
+                       (or eos blank))
+                  (seq ?` (group-n 1 (literal char)) ?`)))
+          command start)
+         (= pos (match-beginning 1)))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -761,11 +797,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..80b6393931 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,34 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo `bar`?" 9))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0003-Dedup-dired-aux-isolated-char-searching-Bug-35564.patch

From e2d8c836bfa221205d7c72f8fc983258d24d02ce Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@HIDDEN>
Date: Thu, 27 Jun 2019 19:15:56 -0400
Subject: [PATCH 3/6] Dedup dired-aux isolated char searching (Bug#35564)

* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to return
the first isolated match.
(dired--no-subst-prompt): Operate on a list of positions rather than
searching again for isolated chars.  Shorten prompt, and include the
character being asked about in the question (to make it clearer, and
in case the user can't see the fontification for whatever reason,
e.g., screen reader).
(dired--isolated-char-p): Remove.
(dired--need-confirm-positions): New function.
(dired-do-shell-command): Use it.
* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p): Remove.
(dired-test-highlight-metachar): Adjust to new functions.  Make sure
that `*` isn't considered isolated.
---
 lisp/dired-aux.el            | 113 ++++++++++++++++-------------------
 test/lisp/dired-aux-tests.el |  31 +++++-----
 2 files changed, 67 insertions(+), 77 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d184598b92..32a4988498 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -60,60 +60,60 @@ dired-isolated-string-re
 of a string followed/prefixed with an space.
 The regexp capture the preceding blank, STRING and the following blank as
 the groups 1, 2 and 3 respectively."
-  (format "\\(\\`\\|[ \t]\\)\\(%s\\)\\([ \t]\\|\\'\\)" string))
+  (format "\\(?1:\\`\\|[ \t]\\)\\(?2:%s\\)\\(?3:[ \t]\\|\\'\\)" string))
 
-(defun dired--star-or-qmark-p (string match &optional keep)
+(defun dired--star-or-qmark-p (string match &optional keep start)
   "Return non-nil if STRING contains isolated MATCH or `\\=`?\\=`'.
 MATCH should be the strings \"?\", `\\=`?\\=`', \"*\" or nil.  The latter
 means STRING contains either \"?\" or `\\=`?\\=`' or \"*\".
 If optional arg KEEP is non-nil, then preserve the match data.  Otherwise,
 this function changes it and saves MATCH as the second match group.
+START is the position to start matching from.
 
 Isolated means that MATCH is surrounded by spaces or at the beginning/end
 of STRING followed/prefixed with an space.  A match to `\\=`?\\=`',
 isolated or not, is also valid."
-  (let ((regexps (list (dired-isolated-string-re (if match (regexp-quote match) "[*?]")))))
+  (let ((regexp (dired-isolated-string-re (if match (regexp-quote match) "[*?]"))))
     (when (or (null match) (equal match "?"))
-      (setq regexps (append (list "\\(\\)\\(`\\?`\\)\\(\\)") regexps)))
-    (cl-some (lambda (x)
-               (funcall (if keep #'string-match-p #'string-match) x string))
-             regexps)))
-
-(defun dired--isolated-char-p (command pos)
-  "Assert whether the character at POS is isolated within COMMAND.
-A character is isolated if:
-- it is surrounded by whitespace, the start of the command, or
-  the end of the command,
-- it is surrounded by `\\=`' characters."
-  (let ((start (max 0 (1- pos)))
-        (char (string (aref command pos))))
-    (and (string-match
-          (rx (or (seq (or bos blank)
-                       (group-n 1 (literal char))
-                       (or eos blank))
-                  (seq ?` (group-n 1 (literal char)) ?`)))
-          command start)
-         (= pos (match-beginning 1)))))
-
-(defun dired--highlight-nosubst-char (command char)
-  "Highlight occurences of CHAR that are not isolated in COMMAND.
-These occurences will not be substituted; they will be sent as-is
-to the shell, which may interpret them as wildcards."
-  (save-match-data
-    (let ((highlighted (substring-no-properties command))
-          (pos 0))
-      (while (string-match (regexp-quote char) command pos)
-        (let ((start (match-beginning 0))
-              (end (match-end 0)))
-          (unless (dired--isolated-char-p command start)
-            (add-face-text-property start end 'warning nil highlighted))
-          (setq pos end)))
-      highlighted)))
-
-(defun dired--no-subst-prompt (command char)
-  (let ((highlighted-command (dired--highlight-nosubst-char command char))
-        (prompt "Confirm--the highlighted characters will not be substituted:"))
-    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+      (cl-callf concat regexp "\\|\\(?1:\\)\\(?2:`\\?`\\)\\(?3:\\)"))
+    (funcall (if keep #'string-match-p #'string-match) regexp string start)))
+
+(defun dired--need-confirm-positions (command string)
+  "Search for non-isolated matches of STRING in COMMAND.
+Return a list of positions that match STRING, but would not be
+considered \"isolated\" by `dired--star-or-qmark-p'."
+  (cl-assert (= (length string) 1))
+  (let ((start 0)
+        (isolated-char-positions nil)
+        (confirm-positions nil)
+        (regexp (regexp-quote string)))
+    ;; Collect all ? and * surrounded by spaces and `?`.
+    (while (dired--star-or-qmark-p command string nil start)
+      (push (cons (match-beginning 2) (match-end 2))
+            isolated-char-positions)
+      (setq start (match-end 2)))
+    ;; Now collect any remaining ? and *.
+    (setq start 0)
+    (while (string-match regexp command start)
+      (unless (cl-member (match-beginning 0) isolated-char-positions
+                         :test (lambda (pos match)
+                                 (<= (car match) pos (cdr match))))
+        (push (match-beginning 0) confirm-positions))
+      (setq start (match-end 0)))
+    confirm-positions))
+
+(defun dired--no-subst-prompt (char-positions command)
+  (cl-callf substring-no-properties command)
+  (dolist (pos char-positions)
+    (add-face-text-property pos (1+ pos) 'warning nil command))
+  (concat command "\n"
+          (format-message
+           (ngettext "Send %d occurence of `%s' as-is to shell?"
+                     "Send %d occurences of `%s' as-is to shell?"
+                     (length char-positions))
+           (length char-positions)
+           (propertize (string (aref command (car char-positions)))
+                       'face 'warning))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -781,26 +781,19 @@ dired-do-shell-command
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
       files)))
-  (cl-flet ((need-confirm-p
-             (cmd str)
-             (let ((res cmd)
-                   (regexp (regexp-quote str)))
-               ;; Drop all ? and * surrounded by spaces and `?`.
-               (while (and (string-match regexp res)
-                           (dired--star-or-qmark-p res str))
-                 (setq res (replace-match "" t t res 2)))
-               (string-match regexp res))))
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
+         (confirmations nil)
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
-         (ok (cond ((not (or on-each no-subst))
-	            (error "You can not combine `*' and `?' substitution marks"))
-	           ((need-confirm-p command "*")
-	            (y-or-n-p (dired--no-subst-prompt command "*")))
-	           ((need-confirm-p command "?")
-	            (y-or-n-p (dired--no-subst-prompt command "?")))
-	           (t))))
+         (ok (cond
+              ((not (or on-each no-subst))
+               (error "You can not combine `*' and `?' substitution marks"))
+              ((setq confirmations (dired--need-confirm-positions command "*"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              ((setq confirmations (dired--need-confirm-positions command "?"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
            (if on-each
@@ -811,7 +804,7 @@ dired-do-shell-command
 	                          nil file-list)
 	     ;; execute the shell command
 	     (dired-run-shell-command
-	      (dired-shell-stuff-it command file-list nil arg))))))))
+              (dired-shell-stuff-it command file-list nil arg)))))))
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 80b6393931..3f4bfffaf6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,34 +114,31 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
-(ert-deftest dired-test-isolated-char-p ()
-  (should (dired--isolated-char-p "?" 0))
-  (should (dired--isolated-char-p "? " 0))
-  (should (dired--isolated-char-p " ?" 1))
-  (should (dired--isolated-char-p " ? " 1))
-  (should (dired--isolated-char-p "foo bar ? baz" 8))
-  (should (dired--isolated-char-p "foo -i`?`" 7))
-  (should-not (dired--isolated-char-p "foo `bar`?" 9))
-  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
-  (should-not (dired--isolated-char-p "foo bar?baz" 7))
-  (should-not (dired--isolated-char-p "foo bar?" 7)))
-
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
-         (result (dired--highlight-nosubst-char command "?")))
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "?")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
     (should-not (text-property-not-all 30 39 'face nil result)))
-  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
-         (result (dired--highlight-nosubst-char command "*")))
+  ;; Note that `?` is considered isolated, but `*` is not.
+  (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "*")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 24 'face result)))
-    (should-not (text-property-not-all 25 29 'face nil result))))
+    (should (equal 'warning (get-text-property 25 'face result)))
+    (should-not (text-property-not-all 26 32 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0004-fixup-Dedup-dired-aux-isolated-char-searching-Bug-35.patch

From 2b93d2984cfa6ad9a33376a198707ebeb9d851b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:29:38 +0200
Subject: [PATCH 4/6] fixup! Dedup dired-aux isolated char searching
 (Bug#35564)

---
 lisp/dired-aux.el            | 4 ++--
 test/lisp/dired-aux-tests.el | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 32a4988498..75c3a8952a 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -108,8 +108,8 @@ dired--no-subst-prompt
     (add-face-text-property pos (1+ pos) 'warning nil command))
   (concat command "\n"
           (format-message
-           (ngettext "Send %d occurence of `%s' as-is to shell?"
-                     "Send %d occurences of `%s' as-is to shell?"
+           (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                     "Send %d occurrences of `%s' as-is to shell?"
                      (length char-positions))
            (length char-positions)
            (propertize (string (aref command (car char-positions)))
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 3f4bfffaf6..ff18edddb6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -118,8 +118,8 @@ dired-test-highlight-metachar
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "?")))
+                  (dired--need-confirm-positions command "?")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
@@ -130,8 +130,8 @@ dired-test-highlight-metachar
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "*")))
+                  (dired--need-confirm-positions command "*")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0005-Add-markers-below-non-isolated-chars-in-dired-prompt.patch

From 5f4b3ed76a0b89f7a3dc2120cd2f29a3e64037bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:17:57 +0200
Subject: [PATCH 5/6] Add '^' markers below non-isolated chars in dired prompt

* lisp/dired-aux.el (dired--mark-positions): New function.
(dired--no-subst-prompt): Use it to show chars without overly
relying on highlighting.
(dired-do-shell-command): When the echo area is wide enough to
display the command without wrapping it, add the markers.

* test/lisp/dired-aux-tests.el (dired-test-highlight-metachar):
Add assertion for '^' marker positions.

(Bug#35564)
---
 lisp/dired-aux.el            | 43 +++++++++++++++++++++--------
 test/lisp/dired-aux-tests.el | 53 ++++++++++++++++++++++++------------
 2 files changed, 68 insertions(+), 28 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 75c3a8952a..262ce64938 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -102,18 +102,35 @@ dired--need-confirm-positions
       (setq start (match-end 0)))
     confirm-positions))
 
-(defun dired--no-subst-prompt (char-positions command)
+(defun dired--mark-positions (positions)
+  (let ((markers (make-string
+                  (1+ (apply #'max positions))
+                  ?\s)))
+    (dolist (pos positions)
+      (setf (aref markers pos) ?^))
+    markers))
+
+(defun dired--no-subst-prompt (char-positions command add-markers)
   (cl-callf substring-no-properties command)
   (dolist (pos char-positions)
     (add-face-text-property pos (1+ pos) 'warning nil command))
-  (concat command "\n"
-          (format-message
-           (ngettext "Send %d occurrence of `%s' as-is to shell?"
-                     "Send %d occurrences of `%s' as-is to shell?"
-                     (length char-positions))
-           (length char-positions)
-           (propertize (string (aref command (car char-positions)))
-                       'face 'warning))))
+  ;; `y-or-n-p' adds some text to the beginning of the prompt when the
+  ;; user fails to answer 'y' or 'n'.  The highlighted command thus
+  ;; cannot be put on the first line of the prompt, since the added
+  ;; text will shove the command to the right, and the '^' markers
+  ;; will become misaligned.
+  (apply #'concat
+         `("Confirm:\n"
+           ,command "\n"
+           ,@(when add-markers
+               (list (dired--mark-positions char-positions) "\n"))
+           ,(format-message
+             (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                       "Send %d occurrences of `%s' as-is to shell?"
+                       (length char-positions))
+             (length char-positions)
+             (propertize (string (aref command (car char-positions)))
+                         'face 'warning)))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -784,15 +801,19 @@ dired-do-shell-command
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
          (confirmations nil)
+         (short-enough (< (length command)
+                          (window-width (minibuffer-window))))
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
          (ok (cond
               ((not (or on-each no-subst))
                (error "You can not combine `*' and `?' substitution marks"))
               ((setq confirmations (dired--need-confirm-positions command "*"))
-               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+               (y-or-n-p (dired--no-subst-prompt confirmations command
+                                                 short-enough)))
               ((setq confirmations (dired--need-confirm-positions command "?"))
-               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+               (y-or-n-p (dired--no-subst-prompt confirmations command
+                                                 short-enough)))
               (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ff18edddb6..58b3def2f5 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -115,30 +115,49 @@ dired-test-bug30624
         (kill-buffer buf)))))
 
 (ert-deftest dired-test-highlight-metachar ()
-  "Check that non-isolated meta-characters are highlighted"
+  "Check that non-isolated meta-characters are highlighted."
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (markers "               ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "?")
-                  command))
-         (result (and (string-match (regexp-quote command) prompt)
-                      (match-string 0 prompt))))
-    (should-not (text-property-not-all 1 14 'face nil result))
-    (should (equal 'warning (get-text-property 15 'face result)))
-    (should-not (text-property-not-all 16 28 'face nil result))
-    (should (equal 'warning (get-text-property 29 'face result)))
-    (should-not (text-property-not-all 30 39 'face nil result)))
+                  command
+                  t))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 4))
+    (should (string-match (regexp-quote command) highlit-command))
+    (should (string-match (regexp-quote markers) (nth 2 lines)))
+    (should-not (text-property-not-all 1 14 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 15 'face highlit-command)))
+    (should-not (text-property-not-all 16 28 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 29 'face highlit-command)))
+    (should-not (text-property-not-all 30 39 'face nil highlit-command)))
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (markers "           ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "*")
-                  command))
-         (result (and (string-match (regexp-quote command) prompt)
-                      (match-string 0 prompt))))
-    (should-not (text-property-not-all 1 10 'face nil result))
-    (should (equal 'warning (get-text-property 11 'face result)))
-    (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 25 'face result)))
-    (should-not (text-property-not-all 26 32 'face nil result))))
+                  command
+                  t))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 4))
+    (should (string-match (regexp-quote command) highlit-command))
+    (should (string-match (regexp-quote markers) (nth 2 lines)))
+    (should-not (text-property-not-all 1 10 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 11 'face highlit-command)))
+    (should-not (text-property-not-all 12 23 'face nil highlit-command))
+    (should (equal 'warning (get-text-property 25 'face highlit-command)))
+    (should-not (text-property-not-all 26 32 'face nil highlit-command))
+  (let* ((command "sed 's/\\?/!/'")
+         (prompt (dired--no-subst-prompt
+                  (dired--need-confirm-positions command "?")
+                  command
+                  nil))
+         (lines (split-string prompt "\n"))
+         (highlit-command (nth 1 lines)))
+    (should (= (length lines) 3))
+    (should (string-match (regexp-quote command) highlit-command))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0006-Simplify-highlighting-assertions.patch

From 086937da30b912e8c0f44e3c7e8e2f5545b4f687 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 12 Jul 2019 16:10:54 +0200
Subject: [PATCH 6/6] Simplify highlighting assertions

* test/lisp/dired-aux-tests.el (dired-test--check-highlighting):
New function.
(dired-test-highlight-metachar): Use it.

(Bug#35564)
---
 test/lisp/dired-aux-tests.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 58b3def2f5..ba10c54332 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,15 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(defun dired-test--check-highlighting (command positions)
+  (let ((start 1))
+    (dolist (pos positions)
+      (should-not (text-property-not-all start (1- pos) 'face nil command))
+      (should (equal 'warning (get-text-property pos 'face command)))
+      (setq start (1+ pos)))
+    (should-not (text-property-not-all
+                 start (length command) 'face nil command))))
+
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted."
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
@@ -127,11 +136,7 @@ dired-test-highlight-metachar
     (should (= (length lines) 4))
     (should (string-match (regexp-quote command) highlit-command))
     (should (string-match (regexp-quote markers) (nth 2 lines)))
-    (should-not (text-property-not-all 1 14 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 15 'face highlit-command)))
-    (should-not (text-property-not-all 16 28 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 29 'face highlit-command)))
-    (should-not (text-property-not-all 30 39 'face nil highlit-command)))
+    (dired-test--check-highlighting highlit-command '(15 29)))
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
          (markers "           ^             ^")
@@ -144,11 +149,7 @@ dired-test-highlight-metachar
     (should (= (length lines) 4))
     (should (string-match (regexp-quote command) highlit-command))
     (should (string-match (regexp-quote markers) (nth 2 lines)))
-    (should-not (text-property-not-all 1 10 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 11 'face highlit-command)))
-    (should-not (text-property-not-all 12 23 'face nil highlit-command))
-    (should (equal 'warning (get-text-property 25 'face highlit-command)))
-    (should-not (text-property-not-all 26 32 'face nil highlit-command))
+    (dired-test--check-highlighting highlit-command '(11 25)))
   (let* ((command "sed 's/\\?/!/'")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "?")
@@ -157,7 +158,8 @@ dired-test-highlight-metachar
          (lines (split-string prompt "\n"))
          (highlit-command (nth 1 lines)))
     (should (= (length lines) 3))
-    (should (string-match (regexp-quote command) highlit-command))))
+    (should (string-match (regexp-quote command) highlit-command))
+    (dired-test--check-highlighting highlit-command '(8))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Again, thank you for your patience and your reviews.


PS: the prompt now looks like this ('?' characters are highlighted with
the warning face):

With markers:

> Confirm:
> sed 's/\?/!/'
>         ^
> Send 1 occurrence of =E2=80=98?=E2=80=99 as-is to shell?

Without markers:

> Confirm:
> sed 's/\?/!/'
> Send 1 occurrence of =E2=80=98?=E2=80=99 as-is to shell?

I added the "Confirm:" line because

- y-or-n-p adds "Please answer y or n.  " before the prompt when the
  user fails to answer correctly, so the markers would not line up if
  the command remained on the first line,

- y-or-n-p adds " (y or n)" after the prompt; I find it more legible to
  have the question next to this suffix, so I did not want to move the
  question to the first line.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 3 Jul 2019 19:47:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 03 15:47:55 2019
Received: from localhost ([127.0.0.1]:50125 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hilEQ-0000F4-3v
	for submit <at> debbugs.gnu.org; Wed, 03 Jul 2019 15:47:55 -0400
Received: from mail-wm1-f42.google.com ([209.85.128.42]:53849)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hilEN-0000Eq-Q3
 for 35564 <at> debbugs.gnu.org; Wed, 03 Jul 2019 15:47:53 -0400
Received: by mail-wm1-f42.google.com with SMTP id x15so3407617wmj.3
 for <35564 <at> debbugs.gnu.org>; Wed, 03 Jul 2019 12:47:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=SuiLqm/GZdtL86R6S+DZYlTuvvvjt7b15eGKwHTdBqM=;
 b=RgZ/eouFy9pWpZgWWAEPPnu2oq9vpteDj0q9WMPsaDAB0Vf8F3Dkh/AJVpvvkhf/Zw
 JRsCDCofPNui/dLvLRbC9CD68tgr/TAoXs4QSia8dD8qmyI9VXmj8cl0ti3+lSxrcMhT
 PTT0uqE4dpr9QS8GIPv5atr+cBslRWjQSTUn6/WOnaNW0a6NSsZqbgWQo+CjHAeOlGC7
 LCdJXCPVLGCWwqo84NzmJv6jLLXxEf+cPSjCzs1CVJvQucMtVyf3FBsekN79IgkBGWHR
 F+yawnRPWAmcxSyQnrMC/CPA4ZoySKkwLms7puZnjKH5nGpekjbpHrU8WN4eD/p7YgBO
 lCiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=SuiLqm/GZdtL86R6S+DZYlTuvvvjt7b15eGKwHTdBqM=;
 b=iM7Ez9zWJ6m0kUWteQdIccmVwMiLPpi7cHc0D5BGC+BThzUppY+m3FvKgUoS7jUXQL
 njxlixzTZxbXUJIHJcLAwaKgPfzCtWKyuQ4qqe4Yld4KnNrd7JjKJGazXSbuT6M+twHh
 OplDXy4zGzTIsqk0823tW79+r6FrMCJgrzxvfygWGbONezIKfFUTXAY/ve0gphod2Q8w
 5o9UR+nZDLSSzeZpcf5hI3ca7Jly3OB+lFOHETjVIS0wwjZMs3sViOZSk2aX1Z5rRUBL
 7Vbnp5LVkYer1vDy9Q4mCI7q+yZ17OK0pMyLNV73JNV211P2CNASpbLt8EcRPR5q3X+1
 grmA==
X-Gm-Message-State: APjAAAUA+hXOPh4Pp9EuBTlQ/DZ2d7EltksqmQMFSzuy6GwVYpEfYbZa
 /KJd7IF2NOKLPXI6N1jdAG0=
X-Google-Smtp-Source: APXvYqyHrKnQ3ockU2Lv16/f2RUyr2ZQIL6nudQ/nEBBAgNNUHjacMA88Kn+bIRidshTGtEK0EPf3g==
X-Received: by 2002:a7b:cae2:: with SMTP id t2mr8904488wml.157.1562183265629; 
 Wed, 03 Jul 2019 12:47:45 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id d24sm6840791wra.43.2019.07.03.12.47.44
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Wed, 03 Jul 2019 12:47:44 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: 35564 <at> debbugs.gnu.org
Subject: bug#35564: [PATCH v4] Tweak dired warning about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN>
Date: Wed, 03 Jul 2019 21:47:40 +0200
In-Reply-To: <87h88cvpkj.fsf_-_@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Wed, 26 Jun 2019 08:16:44 +0200")
Message-ID: <87imsinbmr.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 Drew Adams <drew.adams@HIDDEN>, Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

This series of patches consists in

- the same 2 patches as v3
- Noam's refactoring
- some amendments ("occurrence", order of arguments in tests)
- a proof-of-concept for marking the occurrences with '^'

Here is a list of improvements that I plan on tackling Soonish=E2=84=A2

1. refrain from adding markers if the minibuffer is not wide enough,

2. use (:inherit '(warning underline)) instead of warning, so that
    - if the warning face has some underlining, it is used,
    - otherwise the underline face makes sure that we don't rely only on
      colors.


Thank you all for your your reviews and your patience.  Sorry I can't
manage to take more time to work on this.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From 1f1e6c974a56e834ee09446bac3ab41e6cd6f9af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/5] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.

(Bug#35564)
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 4a1649f601..c59f13b24c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2338,6 +2338,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2675,14 +2678,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.22.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From 2fbda185484b45a9fa70518c064ad55b884387c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/5] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.

(Bug#35564)
---
 lisp/dired-aux.el            | 42 ++++++++++++++++++++++++++++++++----
 test/lisp/dired-aux-tests.el | 28 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 5e4ec4d1ec..079e4f102f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,42 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((start (max 0 (1- pos)))
+        (char (string (aref command pos))))
+    (and (string-match
+          (rx (or (seq (or bos blank)
+                       (group-n 1 (literal char))
+                       (or eos blank))
+                  (seq ?` (group-n 1 (literal char)) ?`)))
+          command start)
+         (= pos (match-beginning 1)))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -759,11 +795,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..80b6393931 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,34 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo `bar`?" 9))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.22.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0003-Dedup-dired-aux-isolated-char-searching-Bug-35564.patch

From 0ecd865a837665b6d7549f1a18eff3b46988a7dd Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@HIDDEN>
Date: Thu, 27 Jun 2019 19:15:56 -0400
Subject: [PATCH 3/5] Dedup dired-aux isolated char searching (Bug#35564)

* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to return
the first isolated match.
(dired--no-subst-prompt): Operate on a list of positions rather than
searching again for isolated chars.  Shorten prompt, and include the
character being asked about in the question (to make it clearer, and
in case the user can't see the fontification for whatever reason,
e.g., screen reader).
(dired--isolated-char-p): Remove.
(dired--need-confirm-positions): New function.
(dired-do-shell-command): Use it.
* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p): Remove.
(dired-test-highlight-metachar): Adjust to new functions.  Make sure
that `*` isn't considered isolated.
---
 lisp/dired-aux.el            | 113 ++++++++++++++++-------------------
 test/lisp/dired-aux-tests.el |  31 +++++-----
 2 files changed, 67 insertions(+), 77 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 079e4f102f..47e1d38223 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -60,60 +60,60 @@ dired-isolated-string-re
 of a string followed/prefixed with an space.
 The regexp capture the preceding blank, STRING and the following blank as
 the groups 1, 2 and 3 respectively."
-  (format "\\(\\`\\|[ \t]\\)\\(%s\\)\\([ \t]\\|\\'\\)" string))
+  (format "\\(?1:\\`\\|[ \t]\\)\\(?2:%s\\)\\(?3:[ \t]\\|\\'\\)" string))
 
-(defun dired--star-or-qmark-p (string match &optional keep)
+(defun dired--star-or-qmark-p (string match &optional keep start)
   "Return non-nil if STRING contains isolated MATCH or `\\=`?\\=`'.
 MATCH should be the strings \"?\", `\\=`?\\=`', \"*\" or nil.  The latter
 means STRING contains either \"?\" or `\\=`?\\=`' or \"*\".
 If optional arg KEEP is non-nil, then preserve the match data.  Otherwise,
 this function changes it and saves MATCH as the second match group.
+START is the position to start matching from.
 
 Isolated means that MATCH is surrounded by spaces or at the beginning/end
 of STRING followed/prefixed with an space.  A match to `\\=`?\\=`',
 isolated or not, is also valid."
-  (let ((regexps (list (dired-isolated-string-re (if match (regexp-quote match) "[*?]")))))
+  (let ((regexp (dired-isolated-string-re (if match (regexp-quote match) "[*?]"))))
     (when (or (null match) (equal match "?"))
-      (setq regexps (append (list "\\(\\)\\(`\\?`\\)\\(\\)") regexps)))
-    (cl-some (lambda (x)
-               (funcall (if keep #'string-match-p #'string-match) x string))
-             regexps)))
-
-(defun dired--isolated-char-p (command pos)
-  "Assert whether the character at POS is isolated within COMMAND.
-A character is isolated if:
-- it is surrounded by whitespace, the start of the command, or
-  the end of the command,
-- it is surrounded by `\\=`' characters."
-  (let ((start (max 0 (1- pos)))
-        (char (string (aref command pos))))
-    (and (string-match
-          (rx (or (seq (or bos blank)
-                       (group-n 1 (literal char))
-                       (or eos blank))
-                  (seq ?` (group-n 1 (literal char)) ?`)))
-          command start)
-         (= pos (match-beginning 1)))))
-
-(defun dired--highlight-nosubst-char (command char)
-  "Highlight occurences of CHAR that are not isolated in COMMAND.
-These occurences will not be substituted; they will be sent as-is
-to the shell, which may interpret them as wildcards."
-  (save-match-data
-    (let ((highlighted (substring-no-properties command))
-          (pos 0))
-      (while (string-match (regexp-quote char) command pos)
-        (let ((start (match-beginning 0))
-              (end (match-end 0)))
-          (unless (dired--isolated-char-p command start)
-            (add-face-text-property start end 'warning nil highlighted))
-          (setq pos end)))
-      highlighted)))
-
-(defun dired--no-subst-prompt (command char)
-  (let ((highlighted-command (dired--highlight-nosubst-char command char))
-        (prompt "Confirm--the highlighted characters will not be substituted:"))
-    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+      (cl-callf concat regexp "\\|\\(?1:\\)\\(?2:`\\?`\\)\\(?3:\\)"))
+    (funcall (if keep #'string-match-p #'string-match) regexp string start)))
+
+(defun dired--need-confirm-positions (command string)
+  "Search for non-isolated matches of STRING in COMMAND.
+Return a list of positions that match STRING, but would not be
+considered \"isolated\" by `dired--star-or-qmark-p'."
+  (cl-assert (= (length string) 1))
+  (let ((start 0)
+        (isolated-char-positions nil)
+        (confirm-positions nil)
+        (regexp (regexp-quote string)))
+    ;; Collect all ? and * surrounded by spaces and `?`.
+    (while (dired--star-or-qmark-p command string nil start)
+      (push (cons (match-beginning 2) (match-end 2))
+            isolated-char-positions)
+      (setq start (match-end 2)))
+    ;; Now collect any remaining ? and *.
+    (setq start 0)
+    (while (string-match regexp command start)
+      (unless (cl-member (match-beginning 0) isolated-char-positions
+                         :test (lambda (pos match)
+                                 (<= (car match) pos (cdr match))))
+        (push (match-beginning 0) confirm-positions))
+      (setq start (match-end 0)))
+    confirm-positions))
+
+(defun dired--no-subst-prompt (char-positions command)
+  (cl-callf substring-no-properties command)
+  (dolist (pos char-positions)
+    (add-face-text-property pos (1+ pos) 'warning nil command))
+  (concat command "\n"
+          (format-message
+           (ngettext "Send %d occurence of `%s' as-is to shell?"
+                     "Send %d occurences of `%s' as-is to shell?"
+                     (length char-positions))
+           (length char-positions)
+           (propertize (string (aref command (car char-positions)))
+                       'face 'warning))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -779,26 +779,19 @@ dired-do-shell-command
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
       files)))
-  (cl-flet ((need-confirm-p
-             (cmd str)
-             (let ((res cmd)
-                   (regexp (regexp-quote str)))
-               ;; Drop all ? and * surrounded by spaces and `?`.
-               (while (and (string-match regexp res)
-                           (dired--star-or-qmark-p res str))
-                 (setq res (replace-match "" t t res 2)))
-               (string-match regexp res))))
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
+         (confirmations nil)
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
-         (ok (cond ((not (or on-each no-subst))
-	            (error "You can not combine `*' and `?' substitution marks"))
-	           ((need-confirm-p command "*")
-	            (y-or-n-p (dired--no-subst-prompt command "*")))
-	           ((need-confirm-p command "?")
-	            (y-or-n-p (dired--no-subst-prompt command "?")))
-	           (t))))
+         (ok (cond
+              ((not (or on-each no-subst))
+               (error "You can not combine `*' and `?' substitution marks"))
+              ((setq confirmations (dired--need-confirm-positions command "*"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              ((setq confirmations (dired--need-confirm-positions command "?"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
            (if on-each
@@ -809,7 +802,7 @@ dired-do-shell-command
 	                          nil file-list)
 	     ;; execute the shell command
 	     (dired-run-shell-command
-	      (dired-shell-stuff-it command file-list nil arg))))))))
+              (dired-shell-stuff-it command file-list nil arg)))))))
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 80b6393931..3f4bfffaf6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,34 +114,31 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
-(ert-deftest dired-test-isolated-char-p ()
-  (should (dired--isolated-char-p "?" 0))
-  (should (dired--isolated-char-p "? " 0))
-  (should (dired--isolated-char-p " ?" 1))
-  (should (dired--isolated-char-p " ? " 1))
-  (should (dired--isolated-char-p "foo bar ? baz" 8))
-  (should (dired--isolated-char-p "foo -i`?`" 7))
-  (should-not (dired--isolated-char-p "foo `bar`?" 9))
-  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
-  (should-not (dired--isolated-char-p "foo bar?baz" 7))
-  (should-not (dired--isolated-char-p "foo bar?" 7)))
-
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
-         (result (dired--highlight-nosubst-char command "?")))
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "?")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
     (should-not (text-property-not-all 30 39 'face nil result)))
-  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
-         (result (dired--highlight-nosubst-char command "*")))
+  ;; Note that `?` is considered isolated, but `*` is not.
+  (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "*")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 24 'face result)))
-    (should-not (text-property-not-all 25 29 'face nil result))))
+    (should (equal 'warning (get-text-property 25 'face result)))
+    (should-not (text-property-not-all 26 32 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.22.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0004-fixup-Dedup-dired-aux-isolated-char-searching-Bug-35.patch

From 8944a2c77e04012593450edd391a0e4ac0be090d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:29:38 +0200
Subject: [PATCH 4/5] fixup! Dedup dired-aux isolated char searching
 (Bug#35564)

---
 lisp/dired-aux.el            | 4 ++--
 test/lisp/dired-aux-tests.el | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 47e1d38223..7ea1191c49 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -108,8 +108,8 @@ dired--no-subst-prompt
     (add-face-text-property pos (1+ pos) 'warning nil command))
   (concat command "\n"
           (format-message
-           (ngettext "Send %d occurence of `%s' as-is to shell?"
-                     "Send %d occurences of `%s' as-is to shell?"
+           (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                     "Send %d occurrences of `%s' as-is to shell?"
                      (length char-positions))
            (length char-positions)
            (propertize (string (aref command (car char-positions)))
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 3f4bfffaf6..ff18edddb6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -118,8 +118,8 @@ dired-test-highlight-metachar
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "?")))
+                  (dired--need-confirm-positions command "?")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
@@ -130,8 +130,8 @@ dired-test-highlight-metachar
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
          (prompt (dired--no-subst-prompt
-                  command
-                  (dired--need-confirm-positions command "*")))
+                  (dired--need-confirm-positions command "*")
+                  command))
          (result (and (string-match (regexp-quote command) prompt)
                       (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
-- 
2.22.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0005-Add-markers-below-non-isolated-chars-in-dired-prompt.patch

From 7f28faa497419aeda4fed6ec413b7d6060f2c203 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Wed, 3 Jul 2019 21:17:57 +0200
Subject: [PATCH 5/5] Add '^' markers below non-isolated chars in dired prompt

* lisp/dired-aux.el (dired--mark-positions): New function.
(dired--no-subst-prompt): Use it.

* test/lisp/dired-aux-tests.el (dired-test-highlight-metachar):
Add assertion for '^' marker positions.

(Bug#35564)
---
 lisp/dired-aux.el            | 25 +++++++++++++++++--------
 test/lisp/dired-aux-tests.el |  8 ++++++--
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 7ea1191c49..cc11f2674f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -102,18 +102,27 @@ dired--need-confirm-positions
       (setq start (match-end 0)))
     confirm-positions))
 
+(defun dired--mark-positions (positions)
+  (let* ((positions (sort positions '<))
+         (markers (make-string (1+ (car (last positions))) ?\s)))
+    (dolist (pos positions)
+      (setf (aref markers pos) ?^))
+    markers))
+
 (defun dired--no-subst-prompt (char-positions command)
   (cl-callf substring-no-properties command)
   (dolist (pos char-positions)
     (add-face-text-property pos (1+ pos) 'warning nil command))
-  (concat command "\n"
-          (format-message
-           (ngettext "Send %d occurrence of `%s' as-is to shell?"
-                     "Send %d occurrences of `%s' as-is to shell?"
-                     (length char-positions))
-           (length char-positions)
-           (propertize (string (aref command (car char-positions)))
-                       'face 'warning))))
+  (let ((markers (dired--mark-positions char-positions)))
+    (concat command "\n"
+            markers "\n"
+            (format-message
+             (ngettext "Send %d occurrence of `%s' as-is to shell?"
+                       "Send %d occurrences of `%s' as-is to shell?"
+                       (length char-positions))
+             (length char-positions)
+             (propertize (string (aref command (car char-positions)))
+                         'face 'warning)))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ff18edddb6..fbadfcbf12 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -117,6 +117,7 @@ dired-test-bug30624
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (markers "               ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "?")
                   command))
@@ -126,9 +127,11 @@ dired-test-highlight-metachar
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
-    (should-not (text-property-not-all 30 39 'face nil result)))
+    (should-not (text-property-not-all 30 39 'face nil result))
+    (should (string-match (regexp-quote markers) prompt (1+ (length command)))))
   ;; Note that `?` is considered isolated, but `*` is not.
   (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (markers "           ^             ^")
          (prompt (dired--no-subst-prompt
                   (dired--need-confirm-positions command "*")
                   command))
@@ -138,7 +141,8 @@ dired-test-highlight-metachar
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
     (should (equal 'warning (get-text-property 25 'face result)))
-    (should-not (text-property-not-all 26 32 'face nil result))))
+    (should-not (text-property-not-all 26 32 'face nil result))
+    (should (string-match (regexp-quote markers) prompt (1+ (length command))))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.22.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 29 Jun 2019 14:30:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 29 10:30:18 2019
Received: from localhost ([127.0.0.1]:44778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhEMs-0000sm-5D
	for submit <at> debbugs.gnu.org; Sat, 29 Jun 2019 10:30:18 -0400
Received: from aserp2120.oracle.com ([141.146.126.78]:60912)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hhEMm-0000rU-Rh
 for 35564 <at> debbugs.gnu.org; Sat, 29 Jun 2019 10:30:13 -0400
Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1])
 by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5TESVN4117879;
 Sat, 29 Jun 2019 14:30:06 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=YKWfO8VqEn7nOO20lukKHFJdV9GXeqOKl+DxZPSeRtI=;
 b=FfOTp4vkgMjPRMnS5Y0RUbzIfP8wg7ODpoirkOyYvyDv2ToGfGQXEGkfsNBMCF8oQRM3
 Sv9hB7pDlIW841oUfni2oYCdwM4cNol0kEnvmmvCdwhD7bi/rXdjsJ0HZKTYNM4aPQsJ
 viRCbxhpvb2eExx/1OuK1zwYeqOtFPBnTPcHNfUqGFB2zpmP3Qc82PMRR3LshY7VxsA9
 XC0rNKgMOKQboC9mxIjMRPocu6ZstL74Y3Ltr5xSY9BCXDHTOOKesiQdzlHO7I2jyFGt
 ka4GGGK4JWefgaAHkicboB2H0DowNWVZgSgZX28kCIpKu4pERVQnFEUmH2fA8UIlBR7f 1Q== 
Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80])
 by aserp2120.oracle.com with ESMTP id 2te5tb8b2q-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sat, 29 Jun 2019 14:30:06 +0000
Received: from pps.filterd (userp3030.oracle.com [127.0.0.1])
 by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5TEU47u067355;
 Sat, 29 Jun 2019 14:30:05 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userp3030.oracle.com with ESMTP id 2tdw3sd979-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Sat, 29 Jun 2019 14:30:05 +0000
Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5TEU2tR031080;
 Sat, 29 Jun 2019 14:30:02 GMT
MIME-Version: 1.0
Message-ID: <cc73f407-1afc-4e93-b962-481ce1a4fd38@default>
Date: Sat, 29 Jun 2019 07:30:01 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: RE: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN> <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
 <87ef3dvbgq.fsf@HIDDEN> <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default>
 <87pnmw5wpi.fsf@HIDDEN>
In-Reply-To: <87pnmw5wpi.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4861.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9303
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1906290182
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9303
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1906290182
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 =?utf-8?B?S8OpdmluIExlIEdvdWd1ZWM=?= <kevin.legouguec@HIDDEN>
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: -3.3 (---)

> >> > Confirm--do you mean to send these characters as-is to the shell?
> >> > sed -e 's/foo?/foo!/' -e 's/bar?/bar!'
> >> >              ^                 ^
>=20
> I don't know about the '^' trick, if the minibuffer window is narrow
> enough to cause line wrapping the result won't be very readable.  And I
> doubt a screen reader would handle this kind of thing any better than
> highlighting (someone please correct me if I'm wrong about that).

Another possibility I almost mentioned is to
use, by default, a face that uses `:box' or
`:overline', or some such properties to make
the char occurrences stand out without relying
on color.  That might at least help with some
who have difficulty distinguishing color, but
it's not an ideal solution either.

I don't think we should try to jump through
too many hoops about this.  The main thing,
I think, is to put the char itself in the
sentence preceding the quoted command text.

The use of `^' is not too bad, I think, even
given the problems you mention.  If the char
occurrences that are problematic are not
obvious then a user can cancel the command
and check `*Messages*' for the full feedback.

> Agreed on both these points.  Updated patch is below, it produces
> prompts like these (still using highlighting):
>=20
>     echo foo*
>     Send 1 occurence of =E2=80=98*=E2=80=99 as-is to shell? (y or n)
>=20
>     echo foo* bar* *
>     Send 2 occurences of =E2=80=98*=E2=80=99 as-is to shell? (y or n)

Good.  But "occurrences", not "occurences".

> The last case (where there are both as-is and substituted "*") isn't so
> great without highlighting (you have to count the "*"s and work out if
> something unexpected is happening), but I think it's at least not worse
> than the current situation.

I vote for also adding the ^ indications underneath.

If you think that is too often too problematic then
maybe do something like one of these:

1. Give users a way to opt out or to remove that on
   demand.

2. Automatically remove it, based on window width,
   whether there are multiple lines, or whatever.
   But this should be controllable by a user (e.g.
   an option).

Agreed about use of screenreaders.  Users should
be able to turn off the ^ indicators.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 29 Jun 2019 14:13:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 29 10:13:40 2019
Received: from localhost ([127.0.0.1]:44764 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhE6m-0000Sh-88
	for submit <at> debbugs.gnu.org; Sat, 29 Jun 2019 10:13:40 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47506)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hhE6h-0000SS-PY
 for 35564 <at> debbugs.gnu.org; Sat, 29 Jun 2019 10:13:36 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49027)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hhE6b-0002Fy-EM; Sat, 29 Jun 2019 10:13:29 -0400
Received: from [176.228.60.248] (port=4299 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1hhE6Y-0000JY-74; Sat, 29 Jun 2019 10:13:28 -0400
Date: Sat, 29 Jun 2019 17:13:15 +0300
Message-Id: <83pnmwfpj8.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
In-reply-to: <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default> (message from Drew
 Adams on Fri, 28 Jun 2019 11:43:55 -0700 (PDT))
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN> <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
 <87ef3dvbgq.fsf@HIDDEN> <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, npostavs@HIDDEN, monnier@HIDDEN,
 kevin.legouguec@HIDDEN
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: -3.3 (---)

> Date: Fri, 28 Jun 2019 11:43:55 -0700 (PDT)
> From: Drew Adams <drew.adams@HIDDEN>
> Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>,
>  Stefan Monnier <monnier@HIDDEN>
> 
> > > We should not, in any case, _rely_ on any
> > > highlighting to get across meaning (semantics).
> > > Highlighting should always be an extra - a
> > > nice-to-have.  Some users will not see the
> > > highlighting - it cannot be the only thing that
> > > gets the intended meaning across.
> > >
> > > (Again, I'm not saying that we _are_ relying on
> > > highlighting this way.  I just want to be sure
> > > we're not.  We don't want to unnecessarily
> > > introduce an accessibility problem.)
> > 
> > With the current patches, we absolutely totally completely _would_ rely
> > on highlighting to get across semantics.  Thank you for spelling it out
> > as an accessibility problem; that kind of confirms my nagging feeling
> > that the highlighting method has an unfavorable benefit/cost ratio (IOW,
> > it's cute, but it might make things worse for some users).
> 
> There is likely another way to make those occurrences
> stand out (in addition to, not instead of, highlighting).
> But I'm no expert on that.  Maybe Eli has a suggestion.

We could both highlight and underline the relevant text.  We already
do that in other cases.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 29 Jun 2019 13:48:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 29 09:48:41 2019
Received: from localhost ([127.0.0.1]:43629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hhDia-00084S-Hh
	for submit <at> debbugs.gnu.org; Sat, 29 Jun 2019 09:48:41 -0400
Received: from mail-io1-f47.google.com ([209.85.166.47]:34379)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hhDiU-00084B-OJ
 for 35564 <at> debbugs.gnu.org; Sat, 29 Jun 2019 09:48:38 -0400
Received: by mail-io1-f47.google.com with SMTP id k8so18706870iot.1
 for <35564 <at> debbugs.gnu.org>; Sat, 29 Jun 2019 06:48:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=VfZ+cNCpQ0nF+16vSpu/Aw0nhC2BGBqKPU0aLv6AoBM=;
 b=T4AeQn51ATcGp6rU77cqY5fqGsZ6acvf1jqOtP+EhrO67txmc7qAyRQQ4IdXRloHsw
 YfCsi2oyR7R85EHUzGzB8Av5Ie83B8wqNbe0PWlL+LGgXO5+xootkuy7kL7NQ2OAlzox
 6Kg/sb8AU/aOxRAupanN5wK7s4KtKHH5pJ2TJ9kXSaeUM49U/yMIOmCgqaFN8tJBoeSM
 kBb0PbkF2xbf0ppK0XoikkRvEAM2jc61k5xnlAvlpCj0gwQ5++565uzz8DcUmKhq6euX
 nTtLmqovbHH1gNAUJXw2vzzaGKGsuIC9WG1lYGqIGyaaXgJBT0yZvTx0NEa+9ML0iN9u
 1h6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=VfZ+cNCpQ0nF+16vSpu/Aw0nhC2BGBqKPU0aLv6AoBM=;
 b=kOYhgXU7GbcEr0TO8WpPEu3IKRJx5bGXLoLajX4HTJXpIaezfzUAvTQ45CR9VjXX3H
 EN+IM3aJUVSZ/7FTsV7FiLcVOYJgdN2JTzANrGNKj+sqWC5lik9ZzWUDpxKsoxzZNsjO
 cMP9x8Slx1BDXri1ffVPJ5X+Unz8ygQ9Xfog7bcEY3GcOwFVk4IS7bmcI2VnCV0C2BKe
 +225/n7k/6K/hde6hjBGQ9z2An1+VkC3+sgtqaVlse9/mkNm3w+6QL+pNkAgEqS1gGuA
 P40ghsMqDRrtst3j9lBHzRN/Dl1bIgIJp92izvS3bGiI/+D68rVOUCxz/iPpNq/6Q1eh
 hD7Q==
X-Gm-Message-State: APjAAAVLDHv7GYGQkZs+bFN/xAzRd9unaOo9kr7AlniaI64Uu8+7ZuTo
 tgLjNDC2aEk0HLEtGLrabBk=
X-Google-Smtp-Source: APXvYqyj7Xa+04GWUM24AEKMYTMC0eTLwhFT23QAcLuqvYG37WClvhW6syDeFVVSBnsUvtlxX+WRUw==
X-Received: by 2002:a02:3c07:: with SMTP id m7mr18663047jaa.64.1561816107052; 
 Sat, 29 Jun 2019 06:48:27 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 v13sm4364465ioq.13.2019.06.29.06.48.26
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 29 Jun 2019 06:48:26 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN> <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
 <87ef3dvbgq.fsf@HIDDEN> <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default>
Date: Sat, 29 Jun 2019 09:48:25 -0400
In-Reply-To: <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default> (Drew Adams's
 message of "Fri, 28 Jun 2019 11:43:55 -0700 (PDT)")
Message-ID: <87pnmw5wpi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Drew Adams <drew.adams@HIDDEN> writes:

>> > A final comment, which I'm not sure is relevant:
>> >
>> > We should not, in any case, _rely_ on any
>> > highlighting to get across meaning (semantics).
>> > Highlighting should always be an extra - a
>> > nice-to-have.  Some users will not see the
>> > highlighting - it cannot be the only thing that
>> > gets the intended meaning across.

>> With the current patches, we absolutely totally completely _would_ rely
>> on highlighting to get across semantics.  Thank you for spelling it out
>> as an accessibility problem; that kind of confirms my nagging feeling
>> that the highlighting method has an unfavorable benefit/cost ratio (IOW,
>> it's cute, but it might make things worse for some users).

> There is likely another way to make those occurrences
> stand out (in addition to, not instead of, highlighting).
> But I'm no expert on that.  Maybe Eli has a suggestion.
>
> Emacs doesn't jump through zillions of hoops to try
> maximize accessibility.  But it's good to keep it in
> mind and, at least when other things are equal, to DTRT
> in this regard.

Yes, we should definitely be careful not to make accessibility worse;
thank you for bringing this up Drew.

>> 1. find a simple rephrasing,
>>=20
>> > Confirm--do you mean to send `*' verbatim to the shell?

>> (I don't like this one because it sounds like "do you want us to quote
>> `*' to make sure the shell does not expand it?")

>> 2. keep trying to make a more elaborate prompt, only using some other
>>    tricks to point out the characters.
>>=20
>> > Confirm--do you mean to send these characters as-is to the shell?
>> > sed -e 's/foo?/foo!/' -e 's/bar?/bar!'
>> >              ^                 ^
>>=20
>> (I.e. using '^' to denote the non-isolated characters; not sure how
>> clear it is that "these" refers to "the caracters underlined by a '^'")

I don't know about the '^' trick, if the minibuffer window is narrow
enough to cause line wrapping the result won't be very readable.  And I
doubt a screen reader would handle this kind of thing any better than
highlighting (someone please correct me if I'm wrong about that).

I like the use of "as-is to shell": short and clear.

> Again: drop "Confirm--do you mean to", and use
> "these occurrences of `?'", not "these
> characters".  There is only one char, in perhaps
> multiple locations.
>
> And I do think the char (`?' or whatever) should
> be mentioned explicitly in the question, not just
> have its occurrences indicated in the command to
> be sent.

Agreed on both these points.  Updated patch is below, it produces
prompts like these (still using highlighting):

    echo foo*
    Send 1 occurence of =E2=80=98*=E2=80=99 as-is to shell? (y or n)

    echo foo* bar* *
    Send 2 occurences of =E2=80=98*=E2=80=99 as-is to shell? (y or n)

The last case (where there are both as-is and substituted "*") isn't so
great without highlighting (you have to count the "*"s and work out if
something unexpected is happening), but I think it's at least not worse
than the current situation.


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0003-Dedup-dired-aux-isolated-char-searching-Bug-35564.patch
Content-Description: patch

From e339ad7d83025764645ed9101769467139390432 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@HIDDEN>
Date: Thu, 27 Jun 2019 19:15:56 -0400
Subject: [PATCH 3/3] Dedup dired-aux isolated char searching (Bug#35564)

* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to return
the first isolated match.
(dired--no-subst-prompt): Operate on a list of positions rather than
searching again for isolated chars.  Shorten prompt, and include the
character being asked about in the question (to make it clearer, and
in case the user can't see the fontification for whatever reason,
e.g., screen reader).
(dired--isolated-char-p): Remove.
(dired--need-confirm-positions): New function.
(dired-do-shell-command): Use it.
* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p): Remove.
(dired-test-highlight-metachar): Adjust to new functions.  Make sure
that `*` isn't considered isolated.
---
 lisp/dired-aux.el            | 113 ++++++++++++++++++++-----------------------
 test/lisp/dired-aux-tests.el |  31 ++++++------
 2 files changed, 67 insertions(+), 77 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 079e4f102f..47e1d38223 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -60,60 +60,60 @@ dired-isolated-string-re
 of a string followed/prefixed with an space.
 The regexp capture the preceding blank, STRING and the following blank as
 the groups 1, 2 and 3 respectively."
-  (format "\\(\\`\\|[ \t]\\)\\(%s\\)\\([ \t]\\|\\'\\)" string))
+  (format "\\(?1:\\`\\|[ \t]\\)\\(?2:%s\\)\\(?3:[ \t]\\|\\'\\)" string))
 
-(defun dired--star-or-qmark-p (string match &optional keep)
+(defun dired--star-or-qmark-p (string match &optional keep start)
   "Return non-nil if STRING contains isolated MATCH or `\\=`?\\=`'.
 MATCH should be the strings \"?\", `\\=`?\\=`', \"*\" or nil.  The latter
 means STRING contains either \"?\" or `\\=`?\\=`' or \"*\".
 If optional arg KEEP is non-nil, then preserve the match data.  Otherwise,
 this function changes it and saves MATCH as the second match group.
+START is the position to start matching from.
 
 Isolated means that MATCH is surrounded by spaces or at the beginning/end
 of STRING followed/prefixed with an space.  A match to `\\=`?\\=`',
 isolated or not, is also valid."
-  (let ((regexps (list (dired-isolated-string-re (if match (regexp-quote match) "[*?]")))))
+  (let ((regexp (dired-isolated-string-re (if match (regexp-quote match) "[*?]"))))
     (when (or (null match) (equal match "?"))
-      (setq regexps (append (list "\\(\\)\\(`\\?`\\)\\(\\)") regexps)))
-    (cl-some (lambda (x)
-               (funcall (if keep #'string-match-p #'string-match) x string))
-             regexps)))
-
-(defun dired--isolated-char-p (command pos)
-  "Assert whether the character at POS is isolated within COMMAND.
-A character is isolated if:
-- it is surrounded by whitespace, the start of the command, or
-  the end of the command,
-- it is surrounded by `\\=`' characters."
-  (let ((start (max 0 (1- pos)))
-        (char (string (aref command pos))))
-    (and (string-match
-          (rx (or (seq (or bos blank)
-                       (group-n 1 (literal char))
-                       (or eos blank))
-                  (seq ?` (group-n 1 (literal char)) ?`)))
-          command start)
-         (= pos (match-beginning 1)))))
-
-(defun dired--highlight-nosubst-char (command char)
-  "Highlight occurences of CHAR that are not isolated in COMMAND.
-These occurences will not be substituted; they will be sent as-is
-to the shell, which may interpret them as wildcards."
-  (save-match-data
-    (let ((highlighted (substring-no-properties command))
-          (pos 0))
-      (while (string-match (regexp-quote char) command pos)
-        (let ((start (match-beginning 0))
-              (end (match-end 0)))
-          (unless (dired--isolated-char-p command start)
-            (add-face-text-property start end 'warning nil highlighted))
-          (setq pos end)))
-      highlighted)))
-
-(defun dired--no-subst-prompt (command char)
-  (let ((highlighted-command (dired--highlight-nosubst-char command char))
-        (prompt "Confirm--the highlighted characters will not be substituted:"))
-    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+      (cl-callf concat regexp "\\|\\(?1:\\)\\(?2:`\\?`\\)\\(?3:\\)"))
+    (funcall (if keep #'string-match-p #'string-match) regexp string start)))
+
+(defun dired--need-confirm-positions (command string)
+  "Search for non-isolated matches of STRING in COMMAND.
+Return a list of positions that match STRING, but would not be
+considered \"isolated\" by `dired--star-or-qmark-p'."
+  (cl-assert (= (length string) 1))
+  (let ((start 0)
+        (isolated-char-positions nil)
+        (confirm-positions nil)
+        (regexp (regexp-quote string)))
+    ;; Collect all ? and * surrounded by spaces and `?`.
+    (while (dired--star-or-qmark-p command string nil start)
+      (push (cons (match-beginning 2) (match-end 2))
+            isolated-char-positions)
+      (setq start (match-end 2)))
+    ;; Now collect any remaining ? and *.
+    (setq start 0)
+    (while (string-match regexp command start)
+      (unless (cl-member (match-beginning 0) isolated-char-positions
+                         :test (lambda (pos match)
+                                 (<= (car match) pos (cdr match))))
+        (push (match-beginning 0) confirm-positions))
+      (setq start (match-end 0)))
+    confirm-positions))
+
+(defun dired--no-subst-prompt (char-positions command)
+  (cl-callf substring-no-properties command)
+  (dolist (pos char-positions)
+    (add-face-text-property pos (1+ pos) 'warning nil command))
+  (concat command "\n"
+          (format-message
+           (ngettext "Send %d occurence of `%s' as-is to shell?"
+                     "Send %d occurences of `%s' as-is to shell?"
+                     (length char-positions))
+           (length char-positions)
+           (propertize (string (aref command (car char-positions)))
+                       'face 'warning))))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -779,26 +779,19 @@ dired-do-shell-command
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
       files)))
-  (cl-flet ((need-confirm-p
-             (cmd str)
-             (let ((res cmd)
-                   (regexp (regexp-quote str)))
-               ;; Drop all ? and * surrounded by spaces and `?`.
-               (while (and (string-match regexp res)
-                           (dired--star-or-qmark-p res str))
-                 (setq res (replace-match "" t t res 2)))
-               (string-match regexp res))))
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
+         (confirmations nil)
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
-         (ok (cond ((not (or on-each no-subst))
-	            (error "You can not combine `*' and `?' substitution marks"))
-	           ((need-confirm-p command "*")
-	            (y-or-n-p (dired--no-subst-prompt command "*")))
-	           ((need-confirm-p command "?")
-	            (y-or-n-p (dired--no-subst-prompt command "?")))
-	           (t))))
+         (ok (cond
+              ((not (or on-each no-subst))
+               (error "You can not combine `*' and `?' substitution marks"))
+              ((setq confirmations (dired--need-confirm-positions command "*"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              ((setq confirmations (dired--need-confirm-positions command "?"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
            (if on-each
@@ -809,7 +802,7 @@ dired-do-shell-command
 	                          nil file-list)
 	     ;; execute the shell command
 	     (dired-run-shell-command
-	      (dired-shell-stuff-it command file-list nil arg))))))))
+              (dired-shell-stuff-it command file-list nil arg)))))))
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 80b6393931..3f4bfffaf6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,34 +114,31 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
-(ert-deftest dired-test-isolated-char-p ()
-  (should (dired--isolated-char-p "?" 0))
-  (should (dired--isolated-char-p "? " 0))
-  (should (dired--isolated-char-p " ?" 1))
-  (should (dired--isolated-char-p " ? " 1))
-  (should (dired--isolated-char-p "foo bar ? baz" 8))
-  (should (dired--isolated-char-p "foo -i`?`" 7))
-  (should-not (dired--isolated-char-p "foo `bar`?" 9))
-  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
-  (should-not (dired--isolated-char-p "foo bar?baz" 7))
-  (should-not (dired--isolated-char-p "foo bar?" 7)))
-
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
-         (result (dired--highlight-nosubst-char command "?")))
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "?")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
     (should-not (text-property-not-all 30 39 'face nil result)))
-  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
-         (result (dired--highlight-nosubst-char command "*")))
+  ;; Note that `?` is considered isolated, but `*` is not.
+  (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "*")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 24 'face result)))
-    (should-not (text-property-not-all 25 29 'face nil result))))
+    (should (equal 'warning (get-text-property 25 'face result)))
+    (should-not (text-property-not-all 26 32 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.11.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 28 Jun 2019 18:44:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 28 14:44:09 2019
Received: from localhost ([127.0.0.1]:42977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgvqy-0003hO-Hs
	for submit <at> debbugs.gnu.org; Fri, 28 Jun 2019 14:44:09 -0400
Received: from userp2130.oracle.com ([156.151.31.86]:35932)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hgvqv-0003gj-P7
 for 35564 <at> debbugs.gnu.org; Fri, 28 Jun 2019 14:44:06 -0400
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5SIdgiM112809;
 Fri, 28 Jun 2019 18:43:59 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=NoEAplNqwPTtngcrHp8WIH5Wq8xPo3S/3HyaDVonLxk=;
 b=Zld5oaujWs+K9ngaM3wLybiklAw4jmKRJeoOvJjpUJ7Gy3LJQpU8hgWZRGTOpwEHQi6s
 P0r5/SdQxYMTSEQiLNQuBXEo6DBzSt003YW6p13yaEJDRRCJlkySqGe36ukGV21Ff7Ir
 owuZH5QZG/MJjdWeU8/eeFmoa7bVMi5fhp+BkLJpYuGRlsD+VwodMcqzbkeKeDWrQFKK
 V52xSqSbCltA8ock7Mdlm85YrxrJJnCNUNaRERAznCxEmAIQsZxfC61vTCpoFql3p9a3
 Rp+BHtWnLW72rBtmgWxcF7wDynDq0WT6kQuU4TU6nNv49rrhXXg9vCAOIziqpXaV6w/c Uw== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by userp2130.oracle.com with ESMTP id 2t9brtq4g0-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 28 Jun 2019 18:43:59 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5SIhZsZ020745;
 Fri, 28 Jun 2019 18:43:58 GMT
Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])
 by userp3020.oracle.com with ESMTP id 2tat7e3kdx-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 28 Jun 2019 18:43:58 +0000
Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23])
 by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5SIhurI031550;
 Fri, 28 Jun 2019 18:43:56 GMT
MIME-Version: 1.0
Message-ID: <581e7cf3-a99f-415d-a999-3b2f3f419c8f@default>
Date: Fri, 28 Jun 2019 11:43:55 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?iso-8859-1?B?S+l2aW4gTGUgR291Z3VlYw==?= <kevin.legouguec@HIDDEN>
Subject: RE: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN> <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
 <87ef3dvbgq.fsf@HIDDEN>
In-Reply-To: <87ef3dvbgq.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4861.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9302
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1906280211
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9302
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1906280211
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
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: -3.3 (---)

> > (And too long - "highlighted chars won't be substituted"
> > says the same thing as "the highlighted...".)
>=20
> (Silly question: is it kosher to use contractions such as "won't" in
> user-facing text?  Or were you pointing out the superfluous "the" and/or
> suggesting "chars" rather than "characters"?)

Yes, and yes, and yes.

Well, for the first "yes": I can't vouch for what's
kosher.  But yes.

> >  "Should highlighted chars be substituted? "
> >
> > or
> >
> >  "Substitute highlighted occurrences of `*'? "
>=20
> Mmm; currently this prompt is raised when the code detects that the
> characters will *not* be substituted; answering "yes" makes Dired go on
> with the command, answering "no" aborts.

Yes, I assumed, in saying that, that the sense of
the code would need to be reversed if the question
was put that way.  The question should be in a form
that's easiest for users to understand and not
misunderstand, if that's feasible in terms of code.

> If we phrased the question like you suggest, we should probably change
> the code to actually perform the substitutions should the user answer
> "yes".

Yes, that's what I meant.  But that wording was
just a casual suggestion, to get the point across.
Someone (e.g. you) might well come up with something
better.

> > 1. It's not clear to me what someone will understand
> >    by "substituted" here.  What would (otherwise) be
> >    substituted for what, where, and for what purpose?
> >    What substitution are we talking about, and how
> >    would a user be expected to know what we mean, here?
>=20
> Right.  Not sure how to make things clearer without quoting
> dired-do-shell-command's documentation, which would make the prompt
> quite verbose.

Maybe someone else has a suggestion.  It's worth
working on, I think.

> > 2. Are there multiple different "characterS" involved,
> >    or is the confirmation about only _one_ character,
> >    in (possibly) multiple locations - occurrences of
> >    one char?
>=20
> One character in (possibly) multiple locations.

That's what I thought.  Then don't say chars (plural).

> > 3. Is it the case that the new prompt does not, itself,
> >    show the character?  Do you have to look elsewhere
> >    to see which char or chars(?) are meant by the
> >    prompt?  Shouldn't the prompt itself show the char?
>=20
> It does; the prompt shows the full command, and applies the warning face
> to the character(s).

Good.

> > A final comment, which I'm not sure is relevant:
> >
> > We should not, in any case, _rely_ on any
> > highlighting to get across meaning (semantics).
> > Highlighting should always be an extra - a
> > nice-to-have.  Some users will not see the
> > highlighting - it cannot be the only thing that
> > gets the intended meaning across.
> >
> > (Again, I'm not saying that we _are_ relying on
> > highlighting this way.  I just want to be sure
> > we're not.  We don't want to unnecessarily
> > introduce an accessibility problem.)
>=20
> With the current patches, we absolutely totally completely _would_ rely
> on highlighting to get across semantics.  Thank you for spelling it out
> as an accessibility problem; that kind of confirms my nagging feeling
> that the highlighting method has an unfavorable benefit/cost ratio (IOW,
> it's cute, but it might make things worse for some users).

There is likely another way to make those occurrences
stand out (in addition to, not instead of, highlighting).
But I'm no expert on that.  Maybe Eli has a suggestion.

Emacs doesn't jump through zillions of hoops to try
maximize accessibility.  But it's good to keep it in
mind and, at least when other things are equal, to DTRT
in this regard.

> So to conclude, these are the paths forward that I see:
>=20
> (0. Drop the issue and grit my teeth when the warning shows up.)
>=20
> 1. find a simple rephrasing,
>=20
> 2. keep trying to make a more elaborate prompt, only using some other
>    tricks to point out the characters.
>=20
> Example of path 1:
>=20
> > Confirm--do you mean to send `*' verbatim to the shell?

You can drop "Confirm--".  You could even drop
"do you mean to".  If a reply is required to the
question (e.g. it's `y-or-n-p') then users cannot
avoid it or miss it.

> (I don't like this one because it sounds like "do you want us to quote
> `*' to make sure the shell does not expand it?")
>=20
> Example of path 2:
>=20
> > Confirm--do you mean to send these characters as-is to the shell?
> > sed -e 's/foo?/foo!/' -e 's/bar?/bar!'
> >              ^                 ^
>=20
> (I.e. using '^' to denote the non-isolated characters; not sure how
> clear it is that "these" refers to "the caracters underlined by a '^'")

Much better, IMO.  Again: drop "Confirm--do you
mean to", and use "these occurrences of `?'", not
"these characters".  There is only one char, in
perhaps multiple locations.

And I do think the char (`?' or whatever) should
be mentioned explicitly in the question, not just
have its occurrences indicated in the command to
be sent.

(Thanks for working on this.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 28 Jun 2019 17:58:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 28 13:58:32 2019
Received: from localhost ([127.0.0.1]:42938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgv8p-0000AV-IS
	for submit <at> debbugs.gnu.org; Fri, 28 Jun 2019 13:58:32 -0400
Received: from mail-wr1-f52.google.com ([209.85.221.52]:40295)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hgv8l-0000AD-1u
 for 35564 <at> debbugs.gnu.org; Fri, 28 Jun 2019 13:58:27 -0400
Received: by mail-wr1-f52.google.com with SMTP id p11so7169447wre.7
 for <35564 <at> debbugs.gnu.org>; Fri, 28 Jun 2019 10:58:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=cUKy8CSmOqntMpgq7coaifqfpQgJj01Mk8TSfthjAe0=;
 b=udXtDXtSsxx9Jf5xV1GNWV3kGKp3P9amKU/jS6gtjKU77pQgekbObV0mUXu1lsEJ4b
 9KhG27jVMmYU8CjA1URMMOd7dcZ2Mlt6Zgp/qhsIDMow4azLwsUYvhUL4Ks8Ike/Kz20
 Mv827qVovodLBJAOPl0hdQsALpNnp+982dx1Ow+bRxppSynG2k9LU9uqtR/BHs9hB3od
 VzwsMi/0qiJZSPTWInB/0kis1mbc5VTjlSNuwueo3Ucjwu5sd/Kmfjr9y5gRaZXXAH7b
 sYSuRejhkWkDVzJ6bxQPkuSUjLxJbE6QqYzXEEPcnomtAU3NMmzpIWN+tmKyYRrNxMXX
 rJUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=cUKy8CSmOqntMpgq7coaifqfpQgJj01Mk8TSfthjAe0=;
 b=JHMG0/fYM7Fpfs5oxym66nc3NKiDmfjtdKsJCqK/9U9Y4mXVS4oN9aadaz+bn6M+gV
 Vcpk+kVcgWPW/zWaiUX5kt8/4UbXz13RK60x6mTjSNm0oP05OoeCVsy/wniNiymyXwEb
 /8y+fw7SeiZePJjsQz/dX8R73vpmh3uIraUXVg7xUUubHQe/tbjc5+J+RNbkb9Z0ewZ0
 VuGzsYfAoJUwuq0872YtmMnaXJ/t1ZbRHCNwWpV3XGRwZa9dUGkbXyCDkKGbSRlmv8sY
 kWawB4y8fOKZ9guQob1bHUqHT9wbLd1G56gGZ2GgkcQc6Wv51S2hK1WV7cdEXeFT9dwx
 enbQ==
X-Gm-Message-State: APjAAAXOU5FwJrK25VgnVBYDRbdzq6Oh7vQHnU02V05Z449i+4CQ0KFh
 GCih6PzQfgoFiIbneQiP5tE=
X-Google-Smtp-Source: APXvYqxW+9DFN/JKDkuzrJMRpPJjfeHAbBWkF/KBPkEjiEQ/39dHe4OX38tgG7EzjozuEhd4J0GScw==
X-Received: by 2002:adf:ed41:: with SMTP id u1mr8322716wro.162.1561744700957; 
 Fri, 28 Jun 2019 10:58:20 -0700 (PDT)
Received: from nc10-laptop ([109.190.253.14])
 by smtp.gmail.com with ESMTPSA id j189sm3204666wmb.48.2019.06.28.10.58.17
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 28 Jun 2019 10:58:19 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN>
 <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
Date: Fri, 28 Jun 2019 19:58:13 +0200
In-Reply-To: <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default> (Drew Adams's
 message of "Fri, 28 Jun 2019 08:35:41 -0700 (PDT)")
Message-ID: <87ef3dvbgq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

Drew Adams <drew.adams@HIDDEN> writes:

> But the new question (and actually it's not even a
> question - it should be, no?) seems even less clear
> to me:

A question would probably make the interaction more fluid, I agree.
As fun as messing with text properties has been, I would still very much
favour a simpler solution in the form of a better question (where
"better" mostly means "does not talk about wildcards").

As I mentioned, the only reason I came up with these highlighting
shenanigans is because I could not come up with a better phrasing.

Point taken about the new phrasing possibly being less clear; I was
aiming for some sort of "is the following statement correct? yes/no"
interaction.

> (And too long - "highlighted chars won't be substituted"
> says the same thing as "the highlighted...".)

(Silly question: is it kosher to use contractions such as "won't" in
user-facing text?  Or were you pointing out the superfluous "the" and/or
suggesting "chars" rather than "characters"?)

>  "Should highlighted chars be substituted? "
>
> or
>
>  "Substitute highlighted occurrences of `*'? "

Mmm; currently this prompt is raised when the code detects that the
characters will *not* be substituted; answering "yes" makes Dired go on
with the command, answering "no" aborts.

If we phrased the question like you suggest, we should probably change
the code to actually perform the substitutions should the user answer
"yes".

> 1. It's not clear to me what someone will understand
>    by "substituted" here.  What would (otherwise) be
>    substituted for what, where, and for what purpose?
>    What substitution are we talking about, and how
>    would a user be expected to know what we mean, here?

Right.  Not sure how to make things clearer without quoting
dired-do-shell-command's documentation, which would make the prompt
quite verbose.

> 2. Are there multiple different "characterS" involved,
>    or is the confirmation about only _one_ character,
>    in (possibly) multiple locations - occurrences of
>    one char?

One character in (possibly) multiple locations.

> 3. Is it the case that the new prompt does not, itself,
>    show the character?  Do you have to look elsewhere
>    to see which char or chars(?) are meant by the
>    prompt?  Shouldn't the prompt itself show the char?

It does; the prompt shows the full command, and applies the warning face
to the character(s).

> A final comment, which I'm not sure is relevant:
>
> We should not, in any case, _rely_ on any
> highlighting to get across meaning (semantics).
> Highlighting should always be an extra - a
> nice-to-have.  Some users will not see the
> highlighting - it cannot be the only thing that
> gets the intended meaning across.
>
> (Again, I'm not saying that we _are_ relying on
> highlighting this way.  I just want to be sure
> we're not.  We don't want to unnecessarily
> introduce an accessibility problem.)

With the current patches, we absolutely totally completely _would_ rely
on highlighting to get across semantics.  Thank you for spelling it out
as an accessibility problem; that kind of confirms my nagging feeling
that the highlighting method has an unfavorable benefit/cost ratio (IOW,
it's cute, but it might make things worse for some users).


So to conclude, these are the paths forward that I see:

(0. Drop the issue and grit my teeth when the warning shows up.)

1. find a simple rephrasing,

2. keep trying to make a more elaborate prompt, only using some other
   tricks to point out the characters.

Example of path 1:

> Confirm--do you mean to send `*' verbatim to the shell?

(I don't like this one because it sounds like "do you want us to quote
`*' to make sure the shell does not expand it?")

Example of path 2:

> Confirm--do you mean to send these characters as-is to the shell?
> sed -e 's/foo?/foo!/' -e 's/bar?/bar!'
>              ^                 ^

(I.e. using '^' to denote the non-isolated characters; not sure how
clear it is that "these" refers to "the caracters underlined by a '^'")




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 28 Jun 2019 15:35:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 28 11:35:54 2019
Received: from localhost ([127.0.0.1]:42825 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgsuo-0002hf-9k
	for submit <at> debbugs.gnu.org; Fri, 28 Jun 2019 11:35:54 -0400
Received: from userp2130.oracle.com ([156.151.31.86]:35356)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hgsul-0002hR-Lt
 for 35564 <at> debbugs.gnu.org; Fri, 28 Jun 2019 11:35:52 -0400
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5SFXgSt166631;
 Fri, 28 Jun 2019 15:35:45 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=tGN6d7pdU4B29X2A4DaQVWBgy6KbHSrWYCp4xdSoAqg=;
 b=rc0OL4sJffUlro7hvLQkys6iPRB9KXDeZX/f1/0OiRlqjdkdrhUqZ5Ro8I5O/fyWUTES
 sBYwHHclumIW2kNgBdM13Fd1MJStw90w9CsS9SRnkgcLrMn5vfEOB5DUSlzt0aekGUlt
 xMd9bn69GxiN+yMCETxWlp3pn/2EqmyCox5T2VVM43Gvkyhy3/RltWP+ehiUvBK16Ayr
 i0CYDouJNHkg1TrVBrVyLLh4LEiX8UnZybebGu9A5WWXAJ5H2nUFhkqYsnGamqf4EPPw
 w56mIryfjxAOl9ZOssl0uTcbS6dzWtTswBe3e6sv8bvycxFO9UY/Tx4r/VLk3PNbPrG6 Vg== 
Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70])
 by userp2130.oracle.com with ESMTP id 2t9brtpbw1-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 28 Jun 2019 15:35:45 +0000
Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1])
 by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5SFYrd6112655;
 Fri, 28 Jun 2019 15:35:44 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by aserp3020.oracle.com with ESMTP id 2t9p6vyhpb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 28 Jun 2019 15:35:44 +0000
Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5SFZf6b014162;
 Fri, 28 Jun 2019 15:35:41 GMT
MIME-Version: 1.0
Message-ID: <32acf7a4-70d2-4c33-a3f5-18b082903d4a@default>
Date: Fri, 28 Jun 2019 08:35:41 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?iso-8859-1?B?S+l2aW4gTGUgR291Z3VlYw==?= <kevin.legouguec@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
Subject: RE: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
 <8736jujkvj.fsf@HIDDEN>
In-Reply-To: <8736jujkvj.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4861.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9302
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1906280179
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9302
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1906280180
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -3.3 (---)

(Apologies if I missed something - I took only a
quick look at the patches and the bug report.)

The old question=20

 "Confirm--do you mean to use `*' as a wildcard? "

Seemed clear enough, I thought.  But I see now from
the bug report that it could be confusing.

But the new question (and actually it's not even a
question - it should be, no?) seems even less clear
to me:

 "Confirm--the highlighted characters will not be substituted:"

(And too long - "highlighted chars won't be substituted"
says the same thing as "the highlighted...".)

Maybe something like this?

 "Should highlighted chars be substituted? "

or

 "Substitute highlighted occurrences of `*'? "

But see next -

1. It's not clear to me what someone will understand
   by "substituted" here.  What would (otherwise) be
   substituted for what, where, and for what purpose?
   What substitution are we talking about, and how
   would a user be expected to know what we mean, here?

2. Are there multiple different "characterS" involved,
   or is the confirmation about only _one_ character,
   in (possibly) multiple locations - occurrences of
   one char?

3. Is it the case that the new prompt does not, itself,
   show the character?  Do you have to look elsewhere
   to see which char or chars(?) are meant by the
   prompt?  Shouldn't the prompt itself show the char?

I think more thought might need to be put into this,
by those who understand what the code actually does,
ways in which the resulting behavior could be
confusing, and just what it is we're asking the user
to confirm.

(I'm not one who really understands all of this. I'm
just saying that my guess is that things are still
not so clear after the patching.)

A final comment, which I'm not sure is relevant:

We should not, in any case, _rely_ on any
highlighting to get across meaning (semantics).
Highlighting should always be an extra - a
nice-to-have.  Some users will not see the
highlighting - it cannot be the only thing that
gets the intended meaning across.

(Again, I'm not saying that we _are_ relying on
highlighting this way.  I just want to be sure
we're not.  We don't want to unnecessarily
introduce an accessibility problem.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 28 Jun 2019 06:15:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 28 02:15:56 2019
Received: from localhost ([127.0.0.1]:40252 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgkAu-0002tc-0A
	for submit <at> debbugs.gnu.org; Fri, 28 Jun 2019 02:15:56 -0400
Received: from mail-wr1-f42.google.com ([209.85.221.42]:44661)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hgkAq-0002tN-2b
 for 35564 <at> debbugs.gnu.org; Fri, 28 Jun 2019 02:15:52 -0400
Received: by mail-wr1-f42.google.com with SMTP id r16so3068621wrl.11
 for <35564 <at> debbugs.gnu.org>; Thu, 27 Jun 2019 23:15:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=xe2m+v0xUg9Eo1v92utAIaHQGmR/rlIBcKJ75jq4k0w=;
 b=VrMuuE6mTLpS0/JRTVtRp4xOZWUIBttgoJ9IS2cfvwp7VkzDL1aTtGUf0pzwshuV8X
 0cDZWDurwalh7c8FGiJnNSuhksHY2jMJhFXioIIHAuTosX6mDbpP2oc8yiJnCz6OiS1z
 kOlMR8J116mxH0dSVulQHoQ5oLUHQpU0QPx4iozzfH2R3slbt2gwvh20wELI2twDWhJ+
 UqLAvY7CKiToherXJtM6k+NIVVsQ30Fkjg+bzTY2/TRLHTIBRsY4mcdFNBxeEreGkIWY
 ceRv89DWBBQXFG8C1PqCwrSWC5Wj0xj2mZ54qw92yZB6VxWiU8DwoT4/chfqPNjNnGSF
 UyCw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=xe2m+v0xUg9Eo1v92utAIaHQGmR/rlIBcKJ75jq4k0w=;
 b=hklLw2PQPpl4gc6P2chf16wVPyvySaSrT2ljZbW8w7+gPyC18dhaBKLQk80Bn3QP2A
 8XUcs+37EUsXlkexMlCOjD+u4+idUiEqDwSVYJ5r0AmpiO9IQC45FLqFfnLJAvQ6dotx
 Gg9Le71Wdxn+Klc/eXpkK6yzrlHfev6Pkwhxk+xMZFJRDRINQxfP/XXK43gcHT+KzmKD
 +rb3pTyjCQIbei/392qNxBHwLwewZB7IdG+p8E+Hmnul0KYmUaBFD3aKsuJoTnK2sZm8
 r9ZtANk+N9kAvBJ82V+dYtfel8XleFE/qkWzOFc+lP7pulb4EI/xC/fjtYRgbSO9PHV5
 vYNQ==
X-Gm-Message-State: APjAAAX3l28al2O5Ille2sXD3tPHAWRNdybGpDoJJdV9z18PjGOxnZAU
 /sFkAKJRyCDkTmtiflA10Fs=
X-Google-Smtp-Source: APXvYqxpCRICAfwFiMlyUqrUploMTLkI1uTBOCDL0keqOayQu5teSC7Xf+I/y58zKWyL9I7KItTwnw==
X-Received: by 2002:adf:f98b:: with SMTP id f11mr545257wrr.231.1561702546295; 
 Thu, 27 Jun 2019 23:15:46 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id o4sm1046553wmh.35.2019.06.27.23.15.44
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Thu, 27 Jun 2019 23:15:45 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <87a7e27gh5.fsf@HIDDEN>
Date: Fri, 28 Jun 2019 08:15:44 +0200
In-Reply-To: <87a7e27gh5.fsf@HIDDEN> (Noam Postavsky's message of "Thu, 27
 Jun 2019 19:31:34 -0400")
Message-ID: <8736jujkvj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain

Noam Postavsky <npostavs@HIDDEN> writes:

> Yes, this was kind of bugging me, so here's a patch to reuse that logic
> (it applies on top of yours).  While doing this I noticed that we
> earlier missed that `*` is not considered isolated, unlike `?`.

Thank you very much!

> Assuming no problems, I'll just push your two patches followed by mine

Fine by me, although it just occurs to me that I forgot to mention the
bug number in my commit messages.  Here are updated patches:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From f34a6271f86e2f6045fc8e37c157676e046f85a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/2] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.

(Bug#35564)
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index baff1e909a..67c4f1da3a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2334,6 +2334,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2671,14 +2674,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.21.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From a70bbeae31315a3c1b8baf979e27be3dbc4f7eac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/2] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.

(Bug#35564)
---
 lisp/dired-aux.el            | 42 ++++++++++++++++++++++++++++++++----
 test/lisp/dired-aux-tests.el | 28 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 5e4ec4d1ec..079e4f102f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,42 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((start (max 0 (1- pos)))
+        (char (string (aref command pos))))
+    (and (string-match
+          (rx (or (seq (or bos blank)
+                       (group-n 1 (literal char))
+                       (or eos blank))
+                  (seq ?` (group-n 1 (literal char)) ?`)))
+          command start)
+         (= pos (match-beginning 1)))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -759,11 +795,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..80b6393931 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,34 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo `bar`?" 9))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.21.0


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


> +(defun dired--no-subst-prompt (command char-positions)
> [=E2=80=A6]
> +              ((setq confirmations (dired--need-confirm-positions comman=
d "*"))
> +               (y-or-n-p (dired--no-subst-prompt confirmations command)))
> +              ((setq confirmations (dired--need-confirm-positions comman=
d "?"))
> +               (y-or-n-p (dired--no-subst-prompt command confirmations)))

Mmmm, am I missing something, or have the arguments to
dired--no-subst-prompt been reversed in the "*" case?  I.e. shoudn't

> +               (y-or-n-p (dired--no-subst-prompt confirmations command)))

rather be

> +               (y-or-n-p (dired--no-subst-prompt command confirmations)))

?  As things stand, "! grep 'foo.*'" in Dired fails, saying:

    let: Wrong type argument: stringp, (9)

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jun 2019 23:31:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 27 19:31:45 2019
Received: from localhost ([127.0.0.1]:40044 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgdrk-0004up-Hq
	for submit <at> debbugs.gnu.org; Thu, 27 Jun 2019 19:31:45 -0400
Received: from mail-io1-f48.google.com ([209.85.166.48]:41156)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hgdri-0004uX-0m
 for 35564 <at> debbugs.gnu.org; Thu, 27 Jun 2019 19:31:42 -0400
Received: by mail-io1-f48.google.com with SMTP id w25so8564150ioc.8
 for <35564 <at> debbugs.gnu.org>; Thu, 27 Jun 2019 16:31:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=Pv0cxXyHHBsyDSzRmrIYQ9v0qVxl5w9fg8tTwEvhy6s=;
 b=IrS+w9Czzba+0kTuNMJbMSTi8MnG83JSoA/Rui8rJWixkjdwFOWW61c3gnKHgq6I0H
 0U9n5c5Yw34AflBfFDy3iX3jc2AZCwOcE2P37PlF6XfQDj6sy8TcZNqeyYlr613WfrVe
 +8Wm0LWo5I+WelFk8PBMfe4WCp4TPcI665DLatKI+93oksFpiturTU5Y9gw2WW4kVSOs
 cB9JtLoAzKi5OecO1+OyqQ/4wk3KCOiPAyC0iLZaHAVtAiRsejMPOO4tPI4q+wqZykqx
 N0LcpnABFSNcdJD2UACuZ0b31QSvn4Opdv++Ek3YR/GPesZFyVug0PqOLvjKRw98xRWB
 xd4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=Pv0cxXyHHBsyDSzRmrIYQ9v0qVxl5w9fg8tTwEvhy6s=;
 b=IzVN521C7Ps6DM53uqkhJUKum9Dne7avaN+c40g1DNGIRNwT/5U8LM5/uwuyp9UkbL
 oq7FFxX90Kqr9O1pjEjFjcSC8nWFil6auKgFkjpzjPknkMOE72jZnRgW2sGTB8qpjIEw
 Dm4wtK85AIne1GSK9xxl1ZfMDekba9qRxm8wq9JBNwLyRRauWpuJLR6ewO0mW9m/J7qv
 HlroxFz+bHW46OV/pZcn/JxjlcwokSvTpeMs+6TQM6U4c9b8yYNdIlLLLjmtX+qKnJJq
 WpFPfA3dUkkIsTYjwrCglpXPJOXSseXZ0Rn7XObLziDgkcRV03QL4VHFlwtiknK+n07o
 se0Q==
X-Gm-Message-State: APjAAAUwewbPLlytnmBCt80PE6wLMhCYoFBqx2OqS0sJCmy3bfWUyjZg
 4j8B7Nm3PgVNvT0Yi+5P5QY=
X-Google-Smtp-Source: APXvYqx6V6UGh8CE5+kDkMKhOf8Op2AlflUCrhZwnADFWMHD+wn1LnHEhcxTdgCsVV5jvF/l8ddV8w==
X-Received: by 2002:a6b:1604:: with SMTP id 4mr7161819iow.245.1561678296274;
 Thu, 27 Jun 2019 16:31:36 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 a7sm1008761iok.19.2019.06.27.16.31.34
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 27 Jun 2019 16:31:35 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN>
Date: Thu, 27 Jun 2019 19:31:34 -0400
In-Reply-To: <87h88cvpkj.fsf_-_@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Wed, 26 Jun 2019 08:16:44 +0200")
Message-ID: <87a7e27gh5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

>> 2. dired-aux.el already contains some logic to detect isolated
>>    characters

Yes, this was kind of bugging me, so here's a patch to reuse that logic
(it applies on top of yours).  While doing this I noticed that we
earlier missed that `*` is not considered isolated, unlike `?`.

Assuming no problems, I'll just push your two patches followed by mine
(I considered squashing, but probably that makes things harder to
follow in this case).


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0003-Dedup-dired-aux-isolated-char-searching.patch
Content-Description: patch

From 52af7efc5e0c673b24e09991db275112212f3fbf Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@HIDDEN>
Date: Thu, 27 Jun 2019 19:15:56 -0400
Subject: [PATCH 3/3] Dedup dired-aux isolated char searching

* lisp/dired-aux.el (dired-isolated-string-re): Use explicitly
numbered groups.
(dired--star-or-qmark-p): Add START parameter.  Make sure to return
the first isolated match.
(dired--no-subst-prompt): Operate on a list of positions rather than
searching again for isolated chars.
(dired--isolated-char-p): Remove.
(dired--need-confirm-positions): New function.
(dired-do-shell-command): Use it.
* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p): Remove.
(dired-test-highlight-metachar): Adjust to new functions.  Make sure
that `*` isn't considered isolated.
---
 lisp/dired-aux.el            | 108 +++++++++++++++++++------------------------
 test/lisp/dired-aux-tests.el |  31 ++++++-------
 2 files changed, 62 insertions(+), 77 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 079e4f102f..e716b2b42c 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -60,60 +60,55 @@ (defun dired-isolated-string-re (string)
 of a string followed/prefixed with an space.
 The regexp capture the preceding blank, STRING and the following blank as
 the groups 1, 2 and 3 respectively."
-  (format "\\(\\`\\|[ \t]\\)\\(%s\\)\\([ \t]\\|\\'\\)" string))
+  (format "\\(?1:\\`\\|[ \t]\\)\\(?2:%s\\)\\(?3:[ \t]\\|\\'\\)" string))
 
-(defun dired--star-or-qmark-p (string match &optional keep)
+(defun dired--star-or-qmark-p (string match &optional keep start)
   "Return non-nil if STRING contains isolated MATCH or `\\=`?\\=`'.
 MATCH should be the strings \"?\", `\\=`?\\=`', \"*\" or nil.  The latter
 means STRING contains either \"?\" or `\\=`?\\=`' or \"*\".
 If optional arg KEEP is non-nil, then preserve the match data.  Otherwise,
 this function changes it and saves MATCH as the second match group.
+START is the position to start matching from.
 
 Isolated means that MATCH is surrounded by spaces or at the beginning/end
 of STRING followed/prefixed with an space.  A match to `\\=`?\\=`',
 isolated or not, is also valid."
-  (let ((regexps (list (dired-isolated-string-re (if match (regexp-quote match) "[*?]")))))
+  (let ((regexp (dired-isolated-string-re (if match (regexp-quote match) "[*?]"))))
     (when (or (null match) (equal match "?"))
-      (setq regexps (append (list "\\(\\)\\(`\\?`\\)\\(\\)") regexps)))
-    (cl-some (lambda (x)
-               (funcall (if keep #'string-match-p #'string-match) x string))
-             regexps)))
-
-(defun dired--isolated-char-p (command pos)
-  "Assert whether the character at POS is isolated within COMMAND.
-A character is isolated if:
-- it is surrounded by whitespace, the start of the command, or
-  the end of the command,
-- it is surrounded by `\\=`' characters."
-  (let ((start (max 0 (1- pos)))
-        (char (string (aref command pos))))
-    (and (string-match
-          (rx (or (seq (or bos blank)
-                       (group-n 1 (literal char))
-                       (or eos blank))
-                  (seq ?` (group-n 1 (literal char)) ?`)))
-          command start)
-         (= pos (match-beginning 1)))))
-
-(defun dired--highlight-nosubst-char (command char)
-  "Highlight occurences of CHAR that are not isolated in COMMAND.
-These occurences will not be substituted; they will be sent as-is
-to the shell, which may interpret them as wildcards."
-  (save-match-data
-    (let ((highlighted (substring-no-properties command))
-          (pos 0))
-      (while (string-match (regexp-quote char) command pos)
-        (let ((start (match-beginning 0))
-              (end (match-end 0)))
-          (unless (dired--isolated-char-p command start)
-            (add-face-text-property start end 'warning nil highlighted))
-          (setq pos end)))
-      highlighted)))
-
-(defun dired--no-subst-prompt (command char)
-  (let ((highlighted-command (dired--highlight-nosubst-char command char))
-        (prompt "Confirm--the highlighted characters will not be substituted:"))
-    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+      (cl-callf concat regexp "\\|\\(?1:\\)\\(?2:`\\?`\\)\\(?3:\\)"))
+    (funcall (if keep #'string-match-p #'string-match) regexp string start)))
+
+(defun dired--need-confirm-positions (command string)
+  "Search for non-isolated matches of STRING in COMMAND.
+Return a list of positions that match STRING, but would not be
+considered \"isolated\" by `dired--star-or-qmark-p'."
+  (cl-assert (= (length string) 1))
+  (let ((start 0)
+        (isolated-char-positions nil)
+        (confirm-positions nil)
+        (regexp (regexp-quote string)))
+    ;; Collect all ? and * surrounded by spaces and `?`.
+    (while (dired--star-or-qmark-p command string nil start)
+      (push (cons (match-beginning 2) (match-end 2))
+            isolated-char-positions)
+      (setq start (match-end 2)))
+    ;; Now collect any remaining ? and *.
+    (setq start 0)
+    (while (string-match regexp command start)
+      (unless (cl-member (match-beginning 0) isolated-char-positions
+                         :test (lambda (pos match)
+                                 (<= (car match) pos (cdr match))))
+        (push (match-beginning 0) confirm-positions))
+      (setq start (match-end 0)))
+    confirm-positions))
+
+(defun dired--no-subst-prompt (command char-positions)
+  (let ((highlighted (substring-no-properties command)))
+    (dolist (pos char-positions)
+      (add-face-text-property pos (1+ pos) 'warning nil highlighted))
+    (format-message "\
+Confirm--the highlighted characters will not be substituted:\n%s
+Proceed?" highlighted)))
 
 ;;;###autoload
 (defun dired-diff (file &optional switches)
@@ -779,26 +774,19 @@ (defun dired-do-shell-command (command &optional arg file-list)
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
       files)))
-  (cl-flet ((need-confirm-p
-             (cmd str)
-             (let ((res cmd)
-                   (regexp (regexp-quote str)))
-               ;; Drop all ? and * surrounded by spaces and `?`.
-               (while (and (string-match regexp res)
-                           (dired--star-or-qmark-p res str))
-                 (setq res (replace-match "" t t res 2)))
-               (string-match regexp res))))
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
 	 (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
+         (confirmations nil)
          ;; Get confirmation for wildcards that may have been meant
          ;; to control substitution of a file name or the file name list.
-         (ok (cond ((not (or on-each no-subst))
-	            (error "You can not combine `*' and `?' substitution marks"))
-	           ((need-confirm-p command "*")
-	            (y-or-n-p (dired--no-subst-prompt command "*")))
-	           ((need-confirm-p command "?")
-	            (y-or-n-p (dired--no-subst-prompt command "?")))
-	           (t))))
+         (ok (cond
+              ((not (or on-each no-subst))
+               (error "You can not combine `*' and `?' substitution marks"))
+              ((setq confirmations (dired--need-confirm-positions command "*"))
+               (y-or-n-p (dired--no-subst-prompt confirmations command)))
+              ((setq confirmations (dired--need-confirm-positions command "?"))
+               (y-or-n-p (dired--no-subst-prompt command confirmations)))
+              (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
            (if on-each
@@ -809,7 +797,7 @@ (defun dired-do-shell-command (command &optional arg file-list)
 	                          nil file-list)
 	     ;; execute the shell command
 	     (dired-run-shell-command
-	      (dired-shell-stuff-it command file-list nil arg))))))))
+              (dired-shell-stuff-it command file-list nil arg)))))))
 
 ;; Might use {,} for bash or csh:
 (defvar dired-mark-prefix ""
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index 80b6393931..3f4bfffaf6 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,34 +114,31 @@ (ert-deftest dired-test-bug30624 ()
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
-(ert-deftest dired-test-isolated-char-p ()
-  (should (dired--isolated-char-p "?" 0))
-  (should (dired--isolated-char-p "? " 0))
-  (should (dired--isolated-char-p " ?" 1))
-  (should (dired--isolated-char-p " ? " 1))
-  (should (dired--isolated-char-p "foo bar ? baz" 8))
-  (should (dired--isolated-char-p "foo -i`?`" 7))
-  (should-not (dired--isolated-char-p "foo `bar`?" 9))
-  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
-  (should-not (dired--isolated-char-p "foo bar?baz" 7))
-  (should-not (dired--isolated-char-p "foo bar?" 7)))
-
 (ert-deftest dired-test-highlight-metachar ()
   "Check that non-isolated meta-characters are highlighted"
   (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
-         (result (dired--highlight-nosubst-char command "?")))
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "?")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 14 'face nil result))
     (should (equal 'warning (get-text-property 15 'face result)))
     (should-not (text-property-not-all 16 28 'face nil result))
     (should (equal 'warning (get-text-property 29 'face result)))
     (should-not (text-property-not-all 30 39 'face nil result)))
-  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
-         (result (dired--highlight-nosubst-char command "*")))
+  ;; Note that `?` is considered isolated, but `*` is not.
+  (let* ((command "sed -e 's/o*/a/' -e 's/o`*` /a/'")
+         (prompt (dired--no-subst-prompt
+                  command
+                  (dired--need-confirm-positions command "*")))
+         (result (and (string-match (regexp-quote command) prompt)
+                      (match-string 0 prompt))))
     (should-not (text-property-not-all 1 10 'face nil result))
     (should (equal 'warning (get-text-property 11 'face result)))
     (should-not (text-property-not-all 12 23 'face nil result))
-    (should (equal 'warning (get-text-property 24 'face result)))
-    (should-not (text-property-not-all 25 29 'face nil result))))
+    (should (equal 'warning (get-text-property 25 'face result)))
+    (should-not (text-property-not-all 26 32 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.11.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jun 2019 06:15:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 27 02:15:35 2019
Received: from localhost ([127.0.0.1]:37304 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgNh1-0008Us-CH
	for submit <at> debbugs.gnu.org; Thu, 27 Jun 2019 02:15:35 -0400
Received: from mail-wm1-f50.google.com ([209.85.128.50]:54096)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hgNgz-0008Ug-Vk
 for 35564 <at> debbugs.gnu.org; Thu, 27 Jun 2019 02:15:34 -0400
Received: by mail-wm1-f50.google.com with SMTP id x15so4423318wmj.3
 for <35564 <at> debbugs.gnu.org>; Wed, 26 Jun 2019 23:15:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=FkJSyz5XA3dqWVgYfxPjlM7F6alJBfv03SvIhs84BsM=;
 b=F3i1B0LeDdGSW2n2IzVdLnTA3LvL+K17Cze0RZ4DE/XtiwvDFGg40ORDiu+DW/BQJ7
 BgAM/GpMFouNF6KXJhhb+YGx13pI56D+gjiN6luCVV53F6g/9lzcWTOU3XKe0BLbduF+
 DIzGEhNkw/ZSqqN0CMks0D4it+ADd0AZ032R9FocfS4huDLUnjcUaJ54aqTtwRW1T96o
 PPEYKkKPdwKq2oz5nHfjLPnd0zI8w75I5d4mRIFJdS/fXSSer9ZBgmf7HCl3dpiHcguz
 bWwxDu0idwejAJs2zAvcoE5MxVPMFSDWXIFuF3Wxu6ELrIoI9TEblLxeH2Dnn+QSpWdK
 3ZFg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=FkJSyz5XA3dqWVgYfxPjlM7F6alJBfv03SvIhs84BsM=;
 b=eoT3pFa02lhjwKlyg5y+0548RUzhxbbdZw6dahFQso1hZQKLnHb5VTFJNn2RE9mtW0
 FiVGwAODhSl7d5RJx7rRpTLbZjkqsgqO3TM1BRagXstjeOlWehlQpnxFNeE/8zFYPxW4
 8mkGhZZ2dda+3FX7MNIjabzAsWGRyLXtBx6FtFTwerRwspU7ewVmHLhuqz75g7cV7zjG
 I3hs0ljGDJXa71s65ydEdmwTC5/gvUY94gY5jYGTW7HBktPBAIsgWpl3Ex3/xT4loj77
 tZw1Nwg2gs/R/eMP18Ic8bZ2sYn/VAUMnxTG2P5BQsR8wznbvc4EdlJp2Gkj9KGOJnIF
 y0Vw==
X-Gm-Message-State: APjAAAXmiWyKgf5DHY46VpI0vWyVZUhdEFOYwORf1sjlEEbfUTtaSISb
 M4SerVw3FWT1hkkM1cQDFXg=
X-Google-Smtp-Source: APXvYqwQ3DZCCa/IDiKiDBhVy77C60VZJJfkVu/T8o/k/XaHDqwjMoRbMITDojYMJodfC2AE/01NTg==
X-Received: by 2002:a1c:6154:: with SMTP id v81mr1769438wmb.92.1561616128193; 
 Wed, 26 Jun 2019 23:15:28 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id 67sm5209272wmd.38.2019.06.26.23.15.27
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Wed, 26 Jun 2019 23:15:27 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN> <jwvmui4quy8.fsf-monnier+emacs@HIDDEN>
Date: Thu, 27 Jun 2019 08:15:25 +0200
In-Reply-To: <jwvmui4quy8.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 26 Jun 2019 10:33:00 -0400")
Message-ID: <87d0izr1tu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

> I wouldn't bother with the read--propertize-prompt auxiliary
> function, but ... LGTM

Fair enough.  I figured having a function would reduce the inertia of
changing other prompts which are propertized rigidly, and make it easier
to (maybe, someday) change the face that these prompts use in one go.

Though it's probably better to wait for a few prompts to be adapted,
deduce some pattern in the way they are propertized, and then introduce
a new function to do the job.  I'll submit a revised patch without the
auxiliary function.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 27 Jun 2019 05:58:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 27 01:58:17 2019
Received: from localhost ([127.0.0.1]:37297 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hgNQG-00085Z-Qw
	for submit <at> debbugs.gnu.org; Thu, 27 Jun 2019 01:58:17 -0400
Received: from mail-wm1-f66.google.com ([209.85.128.66]:50547)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hgNQE-00085M-4Q
 for 35564 <at> debbugs.gnu.org; Thu, 27 Jun 2019 01:58:14 -0400
Received: by mail-wm1-f66.google.com with SMTP id c66so4384259wmf.0
 for <35564 <at> debbugs.gnu.org>; Wed, 26 Jun 2019 22:58:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=KTLSDwivz0EOGDSp9Q0pv3Aty7h6UIYw51FSd0ebM6Q=;
 b=AEHTCUxesB7CS+aO2B0NKEktfKyO5u1Fy1jf+YErg6V8TmKnroIvcnKqduOdM+nyFz
 CluRcvqSWsDUdggEutJAkl34+0Rt0FRNi9h9zE2C6TjVMk5/B0mg0+HekYO8y6cVbULv
 hUZrrglubVhTGD88188GD+otAJ+Cxx14r66vDrFyuOnmW0zMUHm2e02Bv7DQXrxdvCOQ
 hDEAxMBj15yuOU7unK3v94xt8g4L//5ZjPc/0kAwomxwe0ws+316b/RFnQOFvuN4xtTV
 I+3hlBrzdZezCCTkkLJPx5sRU8X5joPz2BdxN4BL9U+JLy/uzQGIHkJW1ICOxSHEYLej
 XZdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=KTLSDwivz0EOGDSp9Q0pv3Aty7h6UIYw51FSd0ebM6Q=;
 b=Z1x+uymayY9J8NmgQSKdyRFcKQlI5DErdtAgs2IC5hXt+PioNchFRRMSS47QUMuyr8
 k3feW8jqA3Ms9Z5Hf6yIxO8TPI08UiCX3RYTbHR391p+wEY2wCRUAijwzJHa9JMl3bF0
 wJLG1OY+07Y4O52truUOv4y79pFqC8yaUx1qhbW9ZSNLQzIk0Ocv3513TpDsXhumPi4b
 PQWb2lH6cAuw9xDIGhcJccPRDvEyIBkGq5LctiqIkvzaX/Z99cf0GNbi8Aqm1n9oTqBs
 4516H1QcTI/3S0pDKLnaQr/epr6owXGUo6wd3NArGTngQYotJwC4AY8fXNa0L1lBfCIC
 ORqw==
X-Gm-Message-State: APjAAAWgq+EkiaOA3z7u/ppJz/biwlTUaghBSMoS/RJ2FRqYBNiLC/R2
 FLtZ4yAwdKYaU2CSLqz0SSY=
X-Google-Smtp-Source: APXvYqxnrNUi/qtdSJovQYDN72TNJ+rszOSKF3TnifaTkc9qd6tq4NGOwS7XApLjgisPvSYsStDHlA==
X-Received: by 2002:a1c:df46:: with SMTP id w67mr1656489wmg.69.1561615088024; 
 Wed, 26 Jun 2019 22:58:08 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id z126sm5979547wmb.32.2019.06.26.22.58.06
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Wed, 26 Jun 2019 22:58:07 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN>
 <5423d87a-a55b-4362-8ae9-b5e25323fb49@default>
Date: Thu, 27 Jun 2019 07:58:06 +0200
In-Reply-To: <5423d87a-a55b-4362-8ae9-b5e25323fb49@default> (Drew Adams's
 message of "Wed, 26 Jun 2019 06:27:52 -0700 (PDT)")
Message-ID: <87ftnvr2mp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

Drew Adams <drew.adams@HIDDEN> writes:

> Please do not hard-code any particular face. Ever.
>
>  (add-face-text-property 0 (length prompt) 
>                          'minibuffer-prompt t prompt))
>                          ^^^^^^^^^^^^^^^^^^
>
> Yes, I know that the code this patch would replace
> already does that.  But it shouldn't.
>
> Nothing is gained by imposing such things on users
> and making it hard for them to control such behavior
> as they wish.

While I am not entirely satisfied with the resolution of the previous
discussion on emacs-devel[1] (mostly because this thread arguably lacks
a resolution[2]), I'd like to cross this bug (i.e. Dired's
brain-tripping warning) off my list before tackling the more general
issue of read-* functions abusing the minibuffer-prompt face.

[1] https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00340.html
[2] https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00344.html





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 26 Jun 2019 14:33:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 10:33:12 2019
Received: from localhost ([127.0.0.1]:36671 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hg8z1-000773-Mk
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2019 10:33:11 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1hg8yy-00076o-KZ
 for 35564 <at> debbugs.gnu.org; Wed, 26 Jun 2019 10:33:09 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0B4F18116F;
 Wed, 26 Jun 2019 10:33:03 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AE9EE8030C;
 Wed, 26 Jun 2019 10:33:01 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1561559581;
 bh=VQbDHxafwJLHY580z5m3tNFLHlf2mOLflMoQX1s3cKE=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=Z2LGVnlL8Jr3RG79PjgnJUL4/O4lo224DA6gpy+twpHWLMeyIN/5/jNdKRZptOcQ7
 yER8BLW7MC+R9urQ6xCsS+uPdZk1hgGJnkHED71Zp8STuT98C5TXHM5Uqg3W2uwao+
 jW8TtAxLhNq1SepUTaLISSAB+FEIUoNa1KZYoWU3dhB+1qE5Ry4hNoEGz0vjA6YHXX
 cPf8GEFEJyO670STT4uGTGHH7HQez5PEB7hPi8F6yVav2ZOqwdjXbSVP6gCxVWMIhI
 Bjz5LgY6JgTr0Cmdit/Bh163O/X2My7/42wvSeeXCMywGpDBSmfNEevZxemj7GghY5
 9G49befgQpK5A==
Received: from pastel (76-10-151-214.dsl.teksavvy.com [76.10.151.214])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7E5B31204BB;
 Wed, 26 Jun 2019 10:33:01 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: =?windows-1252?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
Message-ID: <jwvmui4quy8.fsf-monnier+emacs@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN>
Date: Wed, 26 Jun 2019 10:33:00 -0400
In-Reply-To: <87h88cvpkj.fsf_-_@HIDDEN> (=?windows-1252?Q?=22K=E9vin?= Le
 Gouguec"'s message of "Wed, 26 Jun 2019 08:16:44 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

I wouldn't bother with the read--propertize-prompt auxiliary
function, but ... LGTM (including the use of a hardcoded face ;-)


        Stefan


K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> And here is the third set of patches.
>
>
>
>
> The first patch is unchanged (it adjusts y-or-n-p so that the prompt's
> text properties are preserved), the second patch uses the new
> (literal=C2=A0=E2=80=A6) feature from rx and adds a test case for
> dired--isolated-char-p[1].
>
> Quoting my previous email:
>
>> Some things I wonder about:
>>=20
>> 1. About read--propertize-prompt=E2=80=A6
>>=20
>>     1. Should the function return a copy of its argument instead of
>>        propertizing it directly?
>>=20
>>     2. Is it properly named?  Does it fit in subr.el?  I placed it there
>>        because I figured other users of read-char in subr.el could use
>>        it, e.g. read-char-choice.
>>=20
>> 2. dired-aux.el already contains some logic to detect isolated
>>    characters; I could not think of a way to re-use it, so I added my
>>    own functions to find *non*-isolated characters.  I added unit tests
>>    for these new functions; still, there may be some redundancy there.
>
> Thank you for your time.
>
>
> [1] (should-not (dired--isolated-char-p "foo `bar`?" 9))





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 26 Jun 2019 13:28:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 09:28:05 2019
Received: from localhost ([127.0.0.1]:34512 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hg7y1-0006nG-1z
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2019 09:28:05 -0400
Received: from aserp2120.oracle.com ([141.146.126.78]:34888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hg7xz-0006mn-8f
 for 35564 <at> debbugs.gnu.org; Wed, 26 Jun 2019 09:28:03 -0400
Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1])
 by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QDOGRE147630;
 Wed, 26 Jun 2019 13:27:57 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=kMgzkNu8QSSr+gd7aSOLkfoyhWPHmaXHRMvQSMkoUxA=;
 b=XlVtCAATC++/zckpYiFJtaeB0dJniRqXOFfy/QEoyZkDzKKkGzmEvC3Np/YrE7CI+e0p
 MgbqqOiKGvuXNlXq8YQ3ANELoVkIKZUnUGC9NmEoG/26qJXE2bFA34U3PFWnnaIjeVBh
 ZHHAIja3T08VtT64yUTzVxLK85RplN0Hk5fQcdmhX+NfV5+RxAmcPl8WKf9NE3cWpBpU
 Jh13QN6HE2v8rNJ8Biku0qRvqblLYM+RMXnkpGzegcAieEGm+UuBnBZke+wj0vgI2dyT
 qa+ZbjWv9bVWR1u+a3vTwjbfvrBVaNla/3au2rjblLhiNi4daRUZo3vb5Yp38WNBGSa6 oQ== 
Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70])
 by aserp2120.oracle.com with ESMTP id 2t9c9ptatm-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 26 Jun 2019 13:27:57 +0000
Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1])
 by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QDRegS091788;
 Wed, 26 Jun 2019 13:27:57 GMT
Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])
 by aserp3020.oracle.com with ESMTP id 2t9p6usahq-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 26 Jun 2019 13:27:56 +0000
Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21])
 by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QDRrGO031639;
 Wed, 26 Jun 2019 13:27:53 GMT
MIME-Version: 1.0
Message-ID: <5423d87a-a55b-4362-8ae9-b5e25323fb49@default>
Date: Wed, 26 Jun 2019 06:27:52 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?iso-8859-1?B?S+l2aW4gTGUgR291Z3VlYw==?= <kevin.legouguec@HIDDEN>,
 35564 <at> debbugs.gnu.org
Subject: RE: bug#35564: [PATCH v3] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87h88cvpkj.fsf_-_@HIDDEN>
In-Reply-To: <87h88cvpkj.fsf_-_@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4861.0 (x86)]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299
 signatures=668687
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=881
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1906260161
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299
 signatures=668687
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=948 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1906260160
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: Stefan Monnier <monnier@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
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: -3.3 (---)

Please do not hard-code any particular face. Ever.

 (add-face-text-property 0 (length prompt)=20
                         'minibuffer-prompt t prompt))
                         ^^^^^^^^^^^^^^^^^^

Yes, I know that the code this patch would replace
already does that.  But it shouldn't.

Nothing is gained by imposing such things on users
and making it hard for them to control such behavior
as they wish.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 26 Jun 2019 06:16:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 02:16:56 2019
Received: from localhost ([127.0.0.1]:34128 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hg1El-0002aS-Kq
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2019 02:16:56 -0400
Received: from mail-wm1-f54.google.com ([209.85.128.54]:54074)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hg1Ei-0002aB-7b
 for 35564 <at> debbugs.gnu.org; Wed, 26 Jun 2019 02:16:52 -0400
Received: by mail-wm1-f54.google.com with SMTP id x15so752714wmj.3
 for <35564 <at> debbugs.gnu.org>; Tue, 25 Jun 2019 23:16:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=TdhAek/43zGPzcNCsmaUD2UpphhMrHwFFXzpIg9oHUw=;
 b=LBiyMDTLzvVnxrSFgZA5mtE76peq8YGIIK3nWCGlXyT6V0IJWpP14df/3FvrQNkgar
 BlaKAChX1giwLYXz3SHFkqKspY2wV/1EZSh2X3+tG/3aKBDQ8ZLZGb3kX7XqdhnOacny
 Yr+xypHz+isg510Dvsv2tmefEQT+EZgcYL1HGEegtV932+NprUhFy/wfOf0D8Lf85Upu
 OBaoBns9XQLLIxTleqMosS36HYfgNoj13DjsbAuyvtWumGR2rinO69uO9VcF1Si8vRUw
 Rau6EKasstVL456Ant4s2RnGD2k3R0lf1fIX6zuetnO2pYujmPeJu7M5AHYRaXHr0HrE
 u5TA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=TdhAek/43zGPzcNCsmaUD2UpphhMrHwFFXzpIg9oHUw=;
 b=RJQzbd8dOyM/N5m+Gp4zXep+7t//1KqRp8PROhqr4Zxi/gZ0fIoPjVtHVpQVr+TzUT
 uOt4JUjb8oMg9HUM6xeN+OD4UEYkyVtgFtpf9V4CygpKOd4+pllFu1QSB828gDCqtdEG
 00nXO6IiJ97FgVGTmf+MNpH5RTlYJ/uCmapdXjdWHbAyufWK6TTRJ/WN4lDfi3/PmdZT
 VvMzKEhetTxcW1Q+mAV9IxVVlVWHJzG2RZ2TXGz3IW6v3fs4eDO2mbypVWCwrB9mSV+P
 +nDand/V6vu6a6gpRGhRtp6V4cEJQFWHNc1hlWe1kh4Q8lhKXcShIFP3FUJzzBY138+G
 42Jg==
X-Gm-Message-State: APjAAAXPnhPE7KeS3MiNaE6l9N3klQqeRceaS+5zKaykCqFviFBCpn8H
 YZP84Danry/9Sm7Xko0N4GA=
X-Google-Smtp-Source: APXvYqz1tZo3wWuzaznVf8ipPiZEE6oVN3aFeC2IUrpSGYAur2Bxb9Pz2zQpvX0nRmZS6qnSKfjfLg==
X-Received: by 2002:a1c:a654:: with SMTP id p81mr1209986wme.36.1561529806139; 
 Tue, 25 Jun 2019 23:16:46 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id g19sm961934wmg.10.2019.06.25.23.16.44
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Tue, 25 Jun 2019 23:16:45 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: 35564 <at> debbugs.gnu.org
Subject: bug#35564: [PATCH v3] Tweak dired warning about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
Date: Wed, 26 Jun 2019 08:16:44 +0200
In-Reply-To: <87wohvf22u.fsf@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Sun, 09 Jun 2019 13:08:41 +0200")
Message-ID: <87h88cvpkj.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Stefan Monnier <monnier@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain

And here is the third set of patches.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From d2892b05f08348bbc3eea770a92f7cf735a88cb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/2] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index baff1e909a..67c4f1da3a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2334,6 +2334,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2671,14 +2674,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.21.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From bf49a90f9bf5c03e159dd2377da079e195258ea0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/2] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.
---
 lisp/dired-aux.el            | 42 ++++++++++++++++++++++++++++++++----
 test/lisp/dired-aux-tests.el | 28 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 5e4ec4d1ec..079e4f102f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,42 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((start (max 0 (1- pos)))
+        (char (string (aref command pos))))
+    (and (string-match
+          (rx (or (seq (or bos blank)
+                       (group-n 1 (literal char))
+                       (or eos blank))
+                  (seq ?` (group-n 1 (literal char)) ?`)))
+          command start)
+         (= pos (match-beginning 1)))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -759,11 +795,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..80b6393931 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,34 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo `bar`?" 9))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.21.0


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


The first patch is unchanged (it adjusts y-or-n-p so that the prompt's
text properties are preserved), the second patch uses the new
(literal=C2=A0=E2=80=A6) feature from rx and adds a test case for
dired--isolated-char-p[1].

Quoting my previous email:

> Some things I wonder about:
>=20
> 1. About read--propertize-prompt=E2=80=A6
>=20
>     1. Should the function return a copy of its argument instead of
>        propertizing it directly?
>=20
>     2. Is it properly named?  Does it fit in subr.el?  I placed it there
>        because I figured other users of read-char in subr.el could use
>        it, e.g. read-char-choice.
>=20
> 2. dired-aux.el already contains some logic to detect isolated
>    characters; I could not think of a way to re-use it, so I added my
>    own functions to find *non*-isolated characters.  I added unit tests
>    for these new functions; still, there may be some redundancy there.

Thank you for your time.


[1] (should-not (dired--isolated-char-p "foo `bar`?" 9))


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 19 Jun 2019 00:12:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 20:12:14 2019
Received: from localhost ([127.0.0.1]:45753 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hdOD0-0005OX-DV
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2019 20:12:14 -0400
Received: from mail-io1-f48.google.com ([209.85.166.48]:37820)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hdOCy-0005OI-Py
 for 35564 <at> debbugs.gnu.org; Tue, 18 Jun 2019 20:12:13 -0400
Received: by mail-io1-f48.google.com with SMTP id e5so34127964iok.4
 for <35564 <at> debbugs.gnu.org>; Tue, 18 Jun 2019 17:12:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=GGPf466sOMiONq18O3a3ZhMv3yEAUu0myOEqw5BZzxs=;
 b=J4vR+MF+aln9s7KLwuhVc6ayj0NlSep8zFlLdGuNZN2j2NeVFZqUOVoe/yGqg2lQnQ
 6raMSIOnm1KFUZ4kJOr6Dlsh+0hR3/yzNkeRP2hpaMMTu/td12NZFksOgXtRwLaFhjXT
 aOIh6ZZSuMnGzC5+ANnoEwUmM0Ib+Zbw4i3dyjyZJabrWDe8WkYQsMUVzWE1inSvJq/F
 AIPd0Z4xFOfq3Z2+ImtjvsU11+tZYuV3FFIvz9OUk3hhlbzUzL0wo/ZOPc30+3DbZF0Y
 8v/EAltZWVzjMZBEqZ2ZLfLpJKaY2ZE6v+Vs968cvIUnxxRBkamDnZAmmQK6L+3MrBau
 ft/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=GGPf466sOMiONq18O3a3ZhMv3yEAUu0myOEqw5BZzxs=;
 b=MyZirt0r/AdD+VTftrxtIN/01ZdC7plSns0biFPPlSmRU7KwGuQsYinMoVlZEaVT+R
 pqY9Kpfhb0QrkInstxLxyq4KZpoTdQw+1AzZ9TDUGKXriE99eH1Gf9EhbWtXRbEpKqGa
 L9fGKUtNsRUvYNkMTnykIqWR/bMFTRa9QcO5F3h82iC+f7gMrfSjN2PBASEUgEO6lwvl
 rO8xE/qv+J6wGdcoDPlBko5PSlyS3GxmHyAzHdd3bPmUd5LwrcWVgR+8Ld851C4bYwm2
 3xxl2c0KsHRrQ7tdcrm15iS6Yrv9Hy9YcGaqJgDeH7xIW0sCbiEG9Td4wK2SxsYvMqnM
 60PA==
X-Gm-Message-State: APjAAAUREzOjEqW6oD2f70VH6f+dv/HjHthBk8/odv2h/+FrSedsyoin
 lJP7zKFThmyOI0b9MULtNN8=
X-Google-Smtp-Source: APXvYqz+D7b6d88Na4xBxoTEAofb3l6fxIJ2/Vir00yFgGdQqOrH9ThPdORZrpj09IQ1T4vjbo558g==
X-Received: by 2002:a6b:ce19:: with SMTP id p25mr874065iob.201.1560903125151; 
 Tue, 18 Jun 2019 17:12:05 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 y20sm13347185ion.77.2019.06.18.17.12.04
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 18 Jun 2019 17:12:04 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN> <87tvcum2h6.fsf@HIDDEN>
 <85r27x2zrf.fsf@HIDDEN> <877e9jp95h.fsf@HIDDEN>
Date: Tue, 18 Jun 2019 20:12:03 -0400
In-Reply-To: <877e9jp95h.fsf@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Tue, 18 Jun 2019 10:52:58 +0200")
Message-ID: <87wohiwi0c.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> For a minute I thought that maybe this patch should also add (require
> 'rx) somewhere in dired-aux.el, but AFAICT this is not necessary since
> rx-to-string is autoloaded=E2=80=A6  Do I understand correctly?

Yes, that's correct.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 18 Jun 2019 08:53:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 04:53:09 2019
Received: from localhost ([127.0.0.1]:43741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hd9rZ-00036X-J2
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2019 04:53:09 -0400
Received: from mail-wm1-f54.google.com ([209.85.128.54]:51731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hd9rX-000369-Jb
 for 35564 <at> debbugs.gnu.org; Tue, 18 Jun 2019 04:53:08 -0400
Received: by mail-wm1-f54.google.com with SMTP id 207so2280911wma.1
 for <35564 <at> debbugs.gnu.org>; Tue, 18 Jun 2019 01:53:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=FKGQhl+yQ10JJFBKqo1jqF5Sf6QS2DVtkgA8JzXhRis=;
 b=YewHB5Ir7ZzU7PPFSzq1kTI+jQQ6JHVbmXHEmeENBkz9FcNHUFn2k7VFA4jFoL7IaY
 uNRA87Hhuupbfe5VrXKqck/6wg4gYD1YXGrjtQGZ5mA3tO5XXkUIBL6LrnRH0sxxzADe
 emWFrCKMvJAsiPabfvDdJjqUy2AWq7OcU5EbpyuqIH+PrdLGS4/SVoQAn/IOz9giVRu3
 6HGwBH9LXc6wyGrWzIBddPfBINO2U0CuEU5ocxYWULACqBBqLlNX5d5rKWvXqs3fAFyz
 qTfjOabHdmVWjhCa/B5Vu77g9OwOJdMM+VuA1O9vox7EZNY/IkUlYmkH8Do8McD94I+q
 rtww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=FKGQhl+yQ10JJFBKqo1jqF5Sf6QS2DVtkgA8JzXhRis=;
 b=ByE39FJ1j8nbv8jkcgPkq0oQYKYWnhoBFXmZe1F5qpDxkoUy/TG0eEQzhSGl9Fg7+K
 XRpSH8KDWfrGl3tv0QeSDsK/SemT3IcnuFZJMnYEJLHBpfaBlHNHaOsG0xCnoG4Mmb2C
 1EM1PJh4eHGSInwsTpL2QTb67xCeVmc3q6If8a1VUPNNEbawZ0MW/a7x6yRIKR6oDioW
 DBExErLod6Ax2m8ynqiOGxaFqfKC56XkkdVLHvUCVJaAhFxgXjTUR6QAOQyv7wQ4UdEO
 i+r2MTY7DXFn8J2zKBJQQLtqa6Wlb7vKEWtzxWTyYG593uZ2vDKoLnibgmJamFh4xBvz
 Im2g==
X-Gm-Message-State: APjAAAUnxBuqbbNTbrPXb8KfRAbzVRMpZi/ZXX2Imv5RS5Z6PUKHE+eN
 XQiBb+kg8MINAq7eLqEr0NU=
X-Google-Smtp-Source: APXvYqwNS9DXB1+brvknJn9fv98cdddVBkIvLnD0BlX2eS57Oe+fV411xvfocIns/gXQOqKiybo5Rg==
X-Received: by 2002:a7b:cb94:: with SMTP id m20mr2373088wmi.144.1560847980704; 
 Tue, 18 Jun 2019 01:53:00 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id g5sm15121962wrp.29.2019.06.18.01.52.59
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Tue, 18 Jun 2019 01:52:59 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: npostavs@HIDDEN
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN> <87tvcum2h6.fsf@HIDDEN>
 <85r27x2zrf.fsf@HIDDEN>
Date: Tue, 18 Jun 2019 10:52:58 +0200
In-Reply-To: <85r27x2zrf.fsf@HIDDEN> (npostavs@HIDDEN's message of "Thu, 
 13 Jun 2019 12:53:08 -0400")
Message-ID: <877e9jp95h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

npostavs@HIDDEN writes:

>           (rx-to-string `(or (seq (or bos blank)
>                                   (group-n 1 ,char)
>                                   (or eos blank))
>                              (seq ?` (group-n 1 ,char) ?`)))

Ah!  Thanks for teaching me about \(?NUM: ... \), I did not know this
Elisp extension.  This makes the whole thing much more readable.

For a minute I thought that maybe this patch should also add (require
'rx) somewhere in dired-aux.el, but AFAICT this is not necessary since
rx-to-string is autoloaded=E2=80=A6  Do I understand correctly?

Thanks again for the review, and for your efforts with bug#36237.


(And thank you Stefan for your advice on being superstitious about the
right things :) )




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 13 Jun 2019 16:53:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 13 12:53:17 2019
Received: from localhost ([127.0.0.1]:36033 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hbSyT-0000zT-4Y
	for submit <at> debbugs.gnu.org; Thu, 13 Jun 2019 12:53:17 -0400
Received: from mail-io1-f54.google.com ([209.85.166.54]:41320)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hbSyQ-0000zD-V6
 for 35564 <at> debbugs.gnu.org; Thu, 13 Jun 2019 12:53:15 -0400
Received: by mail-io1-f54.google.com with SMTP id w25so18432783ioc.8
 for <35564 <at> debbugs.gnu.org>; Thu, 13 Jun 2019 09:53:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=8rmcSgjvgHMDVwbuFz19706fMkOVpeOcYPSlCPJ3W/4=;
 b=g9sDfy2qubqsg0RtHRvZ3vzH90tLjTmRbKXtAyg/eRP+UPCpj6iDVANk8Ol/+IFP4L
 cdF5Je9Ct3ODU8EHqS/Ch1Iyxwn7ik8gKQSiZNhx5cTKWwv+sDIinWffbmq/pKwdcdHH
 pygbc/aMDWtN/s8ZBgu6EcgTgj7GpbU1y9VqHAB1YTsZ5J3FZd8fQ2QTbnorXv39yAA5
 ABL+tUNDlAEV9LuD6GLL1yfWUbzneR/wypwDRzPeJZiF/im1lxoMWxv3maVCpvyklEok
 U5fX8+JNER9ljqsO2BCSlbYF/n/Ohezv6gsTkEAJqnshr88X7kuRb8Z1q2FpACKD93Ee
 D9Lw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=8rmcSgjvgHMDVwbuFz19706fMkOVpeOcYPSlCPJ3W/4=;
 b=MTAQkrmSog32cE4NNhHcUqFYA0lg0iYTN0i6nObb9Jh7Va/lpg9M1fJAmpdZo+QefQ
 L8WcG+jNBbxDPYIgdnFfY77EN+HkQr2N5sbiawW7CgymWNezDQwVbRwQ66tnjRKLLjfC
 +VYSTq3tfEbY3yK/qYnFXgtHqz0GBkAsCtz8VXpqyFZmSSx4XKIR8n05mVRHO2EiRHaq
 TSLqIxs8apKS3YCo5uSYloKLzK1SHiJdz/LxK0cdqYkk8CtnTsxC1Jfor2mxviQEWFrc
 cEedKMMZ81dcLlSsXQ3W+gm7prdE5e6zEE8lDgKEKDLXSWucV4ql31bhBOrI2cje5LOw
 4x3g==
X-Gm-Message-State: APjAAAU9WQuzmJBKBfwxSJkYLUUgsqnuujTtgXgIRHgAVZe92093FTNC
 qllfcVQfma21SVTT3+YUARc=
X-Google-Smtp-Source: APXvYqwaH5vHYj8rHFTRf27HdotDQoF1+jpKz4fzgPGQF7Z2dGGkZgSXYjb9SQ2FUGezAbYWN+QS1Q==
X-Received: by 2002:a5d:9282:: with SMTP id s2mr10967549iom.36.1560444789263; 
 Thu, 13 Jun 2019 09:53:09 -0700 (PDT)
Received: from vhost2
 (CPE001143542e1f-CMf81d0f809fa0.cpe.net.cable.rogers.com. [99.230.51.196])
 by smtp.gmail.com with ESMTPSA id j13sm403966ioa.76.2019.06.13.09.53.08
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 13 Jun 2019 09:53:08 -0700 (PDT)
From: npostavs@HIDDEN
To: =?iso-8859-1?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN> <87tvcum2h6.fsf@HIDDEN>
Date: Thu, 13 Jun 2019 12:53:08 -0400
In-Reply-To: <87tvcum2h6.fsf@HIDDEN> (=?iso-8859-1?Q?=22K=E9vin?= Le
 Gouguec"'s message of "Thu, 13 Jun 2019 08:19:33 +0200")
Message-ID: <85r27x2zrf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (windows-nt)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

>
> I think we do care; if I look at what the existing code says,
>
>     (dired--star-or-qmark-p "?`foo`" "?")
>     ;; => nil

>      (let ((start (max 0 (1- pos)))
>            (char (string (aref command pos))))

>                   (rx-to-string '(seq (or bos blank)
>                                       (group char)

`char' in this context translates to the "." regexp (i.e., any
character).  Yeah it's a bit weird.  I have a patch in mind to remove
the need for eval or rx-to-string.  I'll send in a few days (to a new
bug, it's getting off-topic here).

Meanwhile, I suggest:

  (let ((start (max 0 (1- pos)))
        (char (aref command pos)))
    (and (string-match
          (rx-to-string `(or (seq (or bos blank)
                                  (group-n 1 ,char)
                                  (or eos blank))
                             (seq ?` (group-n 1 ,char) ?`)))
          command start)
         (= pos (match-beginning 1))))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 13 Jun 2019 07:59:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 13 03:59:10 2019
Received: from localhost ([127.0.0.1]:34458 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hbKda-0005qI-2z
	for submit <at> debbugs.gnu.org; Thu, 13 Jun 2019 03:59:10 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53577)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1hbKdY-0005q2-2N
 for 35564 <at> debbugs.gnu.org; Thu, 13 Jun 2019 03:59:08 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A16381009AF;
 Thu, 13 Jun 2019 03:59:02 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2B8C810087A;
 Thu, 13 Jun 2019 03:59:01 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1560412741;
 bh=/yFrZKACvdeJaH75m86elSLhSnhP8Vd6joAFvg5cZBo=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=B6OdWrwZWTCG5wqudMEOh3e/nR5zGf1CR9VSFxuWXmQIbGaEgdy/qtz7NN6RoRYun
 PFw7V4gXa6RIF7tM1xocKsbqGZUAMzuRUXTli4V+L84FW7Hcv5WFm6Lfvs7APWo/9e
 mzEv0Y5Upqen/c06pFdEpu9WHRkA3aSjJIzc5hBPO2cmycgW7X7nIC7I/H2IhSqkX7
 hrKC2QINeCIrthV6WW2X6NNfgwG9d/Qv1AAfnCt9bTLcT4bheoxnj6YZxCX1FEMfpI
 ceQCdRO+cO+0Edp8RQJ06Qwg2vuTtbaeY4GKktMteyktmiXFx46tUKbRbdSWsIU4/v
 ud35qGenr9dLw==
Received: from alfajor (cm-84.215.66.78.getinternet.no [84.215.66.78])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 38CC0120AD0;
 Thu, 13 Jun 2019 03:59:00 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: =?windows-1252?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
Message-ID: <jwvh88tsyr6.fsf-monnier+emacs@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN> <87tvcum2h6.fsf@HIDDEN>
Date: Thu, 13 Jun 2019 03:58:58 -0400
In-Reply-To: <87tvcum2h6.fsf@HIDDEN> (=?windows-1252?Q?=22K=E9vin?= Le
 Gouguec"'s message of "Thu, 13 Jun 2019 08:19:33 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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: -1.0 (-)

> I guess it is; I just tend to get superstitious about messing with match
> data.

Instead, you should get superstitious about using the match data too
far from the corresponding match.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 13 Jun 2019 06:19:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 13 02:19:45 2019
Received: from localhost ([127.0.0.1]:34393 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hbJ5N-00033s-2A
	for submit <at> debbugs.gnu.org; Thu, 13 Jun 2019 02:19:45 -0400
Received: from mail-wm1-f45.google.com ([209.85.128.45]:38843)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hbJ5K-00033Z-VE
 for 35564 <at> debbugs.gnu.org; Thu, 13 Jun 2019 02:19:43 -0400
Received: by mail-wm1-f45.google.com with SMTP id s15so8769183wmj.3
 for <35564 <at> debbugs.gnu.org>; Wed, 12 Jun 2019 23:19:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=zsvdYWX22aonVYDP5Kud9jJV2HTd1eM5798IUxtqloY=;
 b=HIJ5+jG/JnzLmi3yMsX/S2YQRSwy8pbjRI+6vmAhskYnwYLxBpnaZU171p1lx1PkTn
 DHVRzWy91n9wtd5IE68hQyycrJSWWBLCxAQHULlp+FvaX57HuF7x1IcXnZz25RQRfgSl
 ccSDbzuFVWIM/gn1gBW3MVarj2BcFiVujq1+MWZwmB8rrsvyJgJC1jPb9TvsJ+DFUYQh
 KHi8Ky3khvsbpSyqUCVooFy9I4tuwizTnFZVVPfSB+TZ+bmmfQJYJ7IJvWPBrSSOH4xV
 E0dIlOSrB3+LGDVqlrF6XmPX6LEwLpRS+hCKMffYmULlzd30lmjypgtt1bW4QtzNnUpW
 6FMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=zsvdYWX22aonVYDP5Kud9jJV2HTd1eM5798IUxtqloY=;
 b=KsqUWbNe7VPNZiTfkJH5ux+tSny6kIpOzml2jucovxjzYmwpDVKlez0nO9Wh89lSJH
 FQIPfQO9lxky/a0YWx5NdkeBgNbTIKRWISLCRHjjDpqiaubtI9QenzT07snvS41Yn/kd
 2XGK5Y1CZqqeJP0ukRCBkJKGCVqMaSGk9rk9VoXG/oLMEkxsQcrbOVdzmYNqo6U1zDAS
 kICPvxMR0NgwXURO9+A5hmi7cQK45fWpNzyhp/EUfxwxIN0Xrxp9v3izEK/EvPEzTHlB
 FBicLR9jpBrKFgA7pHfpL3dxeaDXHrh+rO8DritVY9x6ryAZ8bkKmC2ifxIeozhxOEjM
 ZgEQ==
X-Gm-Message-State: APjAAAW2OM90YPtsmsuulYLKbHUYEFg9SFT1Thn7ubYdR6+yIt4Vn7uI
 p6POp1RKfN3HBvFQ0FKIDxo=
X-Google-Smtp-Source: APXvYqxZwQeW7C+qfo+ZN9j5bAIK60hfciZsExRfa3l2T9yfYDaiEB/8zU7u0ySkDSJxT0pBflla8A==
X-Received: by 2002:a1c:6242:: with SMTP id w63mr2225489wmb.161.1560406776977; 
 Wed, 12 Jun 2019 23:19:36 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id r2sm1786231wma.26.2019.06.12.23.19.35
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Wed, 12 Jun 2019 23:19:36 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN>
Date: Thu, 13 Jun 2019 08:19:33 +0200
In-Reply-To: <87muinyoup.fsf@HIDDEN> (Noam Postavsky's message of "Wed, 12
 Jun 2019 08:23:10 -0400")
Message-ID: <87tvcum2h6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

Noam Postavsky <npostavs@HIDDEN> writes:

> I think this might be better expressed in regexp:

I guess it is; I just tend to get superstitious about messing with match
data.

> Although this gives different results for things like:
>
>     (dired--isolated-char-p "?`foo`" 0)
>
> Do we care about that?  (if yes, then that's a missing test case)

I think we do care; if I look at what the existing code says,

    (dired--star-or-qmark-p "?`foo`" "?")
    ;; =3D> nil

Off the top of my head, this is the best I can come up with to satisfy
this edge case:

    (defun dired--isolated-char-p (command pos)
      "Assert whether the character at POS is isolated within COMMAND.
    A character is isolated if:
    - it is surrounded by whitespace, the start of the command, or
      the end of the command,
    - it is surrounded by `\\=3D`' characters."
      (let ((start (max 0 (1- pos)))
            (char (string (aref command pos))))
        (and (or (string-match
                  (rx-to-string '(seq (or bos blank)
                                      (group char)
                                      (or eos blank)))
                  command start)
                 (string-match
                  (rx-to-string '(seq ?`
                                      (group char)
                                      ?`))
                  command start))
             (=3D pos (match-beginning 1)))))

> And perhaps the regexp above (if it's correct) can be integrated into
> this search?  (maybe not though, since negation isn't straightforward in
> regexps)

I will look into that.


Stefan Monnier <monnier@HIDDEN> writes:

> Can't we use `(... ,.. ..) instead of `eval`?
>
>
>         Stefan

That works too from what I tested, although it's not necessary anymore
with the new version above.


Thank you both for the review!  I will come back with an updated patch
(with the new test case) Some Time Later=E2=84=A2.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 12 Jun 2019 14:29:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 12 10:29:36 2019
Received: from localhost ([127.0.0.1]:33778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hb4Fr-00031J-Sl
	for submit <at> debbugs.gnu.org; Wed, 12 Jun 2019 10:29:36 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42482)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1hb4Fp-000315-QF
 for 35564 <at> debbugs.gnu.org; Wed, 12 Jun 2019 10:29:34 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 94A03100946;
 Wed, 12 Jun 2019 10:29:28 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 659AE1007B5;
 Wed, 12 Jun 2019 10:29:27 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1560349767;
 bh=T29T5eljp+9Tvb8r5LZBNqmieNTKyTBwP+xy4FfozaA=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=pmeZ50/T1tgjON3x2IWrOQsJugBFFF7atkq1Q49uvmZCe0BuCYEqm/zb7fIDOJlPh
 RboT1XF8ZnLf1oGMcBSkXuNL/gx50NEAcObZoRWC1OaG98qjbPimcTd7zdeQ2rUGOB
 oPEBXeM2lwhcUCXY4YSYb7xY1zXfhHRuIMvSC/iNY7th++MFEuxd7EOuhBnrPmuuTg
 MaOwcK0aYdFwib0Km77CTkh+yCtI3MeneRf8r87SXQf986Gs5ZnVeAe6Esxqa6BMxI
 7ywePD0jnhvrsLpl5n5NSJDL/UDLB8AhovmBIaoaZj9oqMvDkTeSMSZWFnFRCjsde2
 hBKThbyjrUgnw==
Received: from alfajor (cm-84.215.66.78.getinternet.no [84.215.66.78])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9C945120C6E;
 Wed, 12 Jun 2019 10:29:26 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
Message-ID: <jwvtvcuubbt.fsf-monnier+emacs@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
 <87muinyoup.fsf@HIDDEN>
Date: Wed, 12 Jun 2019 10:29:25 -0400
In-Reply-To: <87muinyoup.fsf@HIDDEN> (Noam Postavsky's message of "Wed, 12
 Jun 2019 08:23:10 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org,
 =?windows-1252?Q?K=E9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
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: -1.0 (-)

>         (rx-to-string '(seq (or bos (in blank ?`))
>                             (group (eval (string (aref command pos))))
>                             (or eos (in blank ?`))))

Can't we use `(... ,.. ..) instead of `eval`?


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 12 Jun 2019 12:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 12 08:23:22 2019
Received: from localhost ([127.0.0.1]:60843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hb2Hf-0003hu-W7
	for submit <at> debbugs.gnu.org; Wed, 12 Jun 2019 08:23:22 -0400
Received: from mail-it1-f181.google.com ([209.85.166.181]:54368)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hb2Hd-0003hh-Mw
 for 35564 <at> debbugs.gnu.org; Wed, 12 Jun 2019 08:23:18 -0400
Received: by mail-it1-f181.google.com with SMTP id m138so10382941ita.4
 for <35564 <at> debbugs.gnu.org>; Wed, 12 Jun 2019 05:23:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=pRdyNG5JpuS2Ub9Xw/ejRJDDHRRwMk8QlCSMmqmC66M=;
 b=FIj0a4RAsR8TouSYPeJEp/CS6U4Ty7QGtGLmn4ocP33Xd05nprPzBpFixKih+ujKVl
 M8a9X9+FDnqyBOoZxgN1g13Fojw/ZrrX19Ac9vJmLwrdnu5yHLvFXX6PEEmSCCot2dqr
 Z77A0IJzY430FR9Gt+kUyq4qhU4r4QvGv/Nrx+Rpj6mMtVKg0o9yOW2AuLggf3JGPLJK
 pCV1W1jgUwpcychmKoafm6QrypxSDjgJb2CjJECYXUJoiRyGwUXzBNkBNDV12kK7mfD8
 N4BfkhBFotIcKvgyUsVq5nvfZBKGr+JkMoMuy/w56nFwRhL3PyCbKCW0e42nFjEr7Reo
 C6dA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=pRdyNG5JpuS2Ub9Xw/ejRJDDHRRwMk8QlCSMmqmC66M=;
 b=XTOGGjVYQr6GwY3oP/LRKrhtN0ZoQBc9137A2htiRSDlMXl6W8KwMyHDUYjcAnpIYf
 7+p+IJT1sxxFWjltYCRQuNT8s5PerccIe/PbmXYr6vnAGSGJWJsYZ+oIPPCqqKbQgJYD
 KKKNFJJFBLvVq1RCYjmvzSuSemCMh7Zs8ssHPn0rdjYYa7tmLvAFzFO7DnoTeYD4i6KR
 zG1Laco2ljdG7jfX4b3RJtHdelzjVjFk1aEWyjieQkAieyH0/24UWwNcJia5YW6u+2GD
 uEtmxBG62wFeqN/HUL7szHwQ6hmzYub9el07DiMJUT3qWO966DYTygMipZuoYFNHMpcd
 Ctww==
X-Gm-Message-State: APjAAAXZMRf5BiQrjaz2RSepiZrZFpl56Efyrk7oxDus4dCzmz/66pTm
 Fh44iKAAv4oHUL8Sf2F2cd4=
X-Google-Smtp-Source: APXvYqzNb+9aueFgDbeGe7xT8ntBS+W9fCen9Vir+da1jDp9VjUlcDAP6oklr74eYZymKVmaX2xCow==
X-Received: by 2002:a24:9f04:: with SMTP id c4mr21339250ite.176.1560342192044; 
 Wed, 12 Jun 2019 05:23:12 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 y136sm2399696itc.37.2019.06.12.05.23.11
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 12 Jun 2019 05:23:11 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN>
Subject: Re: bug#35564: [PATCH v2] Tweak dired warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN> <87wohvf22u.fsf@HIDDEN>
Date: Wed, 12 Jun 2019 08:23:10 -0400
In-Reply-To: <87wohvf22u.fsf@HIDDEN> (=?utf-8?Q?=22K=C3=A9vin?= Le
 Gouguec"'s message of "Sun, 09 Jun 2019 13:08:41 +0200")
Message-ID: <87muinyoup.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

K=C3=A9vin Le Gouguec <kevin.legouguec@HIDDEN> writes:

> +(defun dired--isolated-char-p (command pos)
> +  "Assert whether the character at POS is isolated within COMMAND.
> +A character is isolated if:
> +- it is surrounded by whitespace, the start of the command, or
> +  the end of the command,
> +- it is surrounded by `\\=3D`' characters."
> +  (let ((n (length command))
> +        (whitespace '(?\s ?\t)))
> +    (or (=3D n 1)
> +        (and (=3D pos 0)
> +             (memq (elt command 1) whitespace))
> +        (and (=3D pos (1- n))
> +             (memq (elt command (1- pos)) whitespace))
> +        (and
> +         (> pos 0)
> +         (< pos (1- n))
> +         (let ((prev (elt command (1- pos)))
> +               (next (elt command (1+ pos))))
> +           (or (and (memq prev whitespace)
> +                    (memq next whitespace))
> +               (and (=3D prev ?`)
> +                    (=3D next ?`))))))))

I think this might be better expressed in regexp:

  (and (string-match
        (rx-to-string '(seq (or bos (in blank ?`))
                            (group (eval (string (aref command pos))))
                            (or eos (in blank ?`))))
        command (max 0 (1- pos)))
       (=3D pos (match-beginning 1)))

Although this gives different results for things like:

    (dired--isolated-char-p "?`foo`" 0)

Do we care about that?  (if yes, then that's a missing test case)

> +(defun dired--highlight-nosubst-char (command char)
> +  "Highlight occurences of CHAR that are not isolated in COMMAND.
> +These occurences will not be substituted; they will be sent as-is
> +to the shell, which may interpret them as wildcards."
> +  (save-match-data
> +    (let ((highlighted (substring-no-properties command))
> +          (pos 0))
> +      (while (string-match (regexp-quote char) command pos)
> +        (let ((start (match-beginning 0))
> +              (end (match-end 0)))
> +          (unless (dired--isolated-char-p command start)
> +            (add-face-text-property start end 'warning nil highlighted))
> +          (setq pos end)))
> +      highlighted)))

And perhaps the regexp above (if it's correct) can be integrated into
this search?  (maybe not though, since negation isn't straightforward in
regexps)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 9 Jun 2019 11:08:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 09 07:08:52 2019
Received: from localhost ([127.0.0.1]:54374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hZvgx-0001n1-US
	for submit <at> debbugs.gnu.org; Sun, 09 Jun 2019 07:08:52 -0400
Received: from mail-wm1-f48.google.com ([209.85.128.48]:51337)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hZvgv-0001ml-Nv
 for 35564 <at> debbugs.gnu.org; Sun, 09 Jun 2019 07:08:50 -0400
Received: by mail-wm1-f48.google.com with SMTP id 207so1026631wma.1
 for <35564 <at> debbugs.gnu.org>; Sun, 09 Jun 2019 04:08:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version;
 bh=hcuTuKk5ozc7mP++rUuLppfOeaAZQS4iv/G7FilvjJs=;
 b=W7e5n0TfYerWyu5gL9ZiCTOt99qnE1iTkHDPpYrX3TcBKUeSa74dVBI3QFLMBWIc2M
 WbNXxiODANjWhytsY7TKkD6ZMX/hW1iLQP+VqasJ+e7c9AI5nizwRhssodJZzmdHWvin
 dKFQfRpTQorkdtTWr3f28pYdoFEgvbH4b4CubGKYIQZdyuOBYvxI5yT8xrHBuAYLumuV
 OHm/IVk/lMsoh8psU7E+wle29bVsELMkyeW9PtWkdI+wIAqa8zWGE0zMPH7Kl7E2UACm
 sK9Cx/kTvm0iye/sLusGaBvPR55n7ohLIGbYUpjHdUY612Fayj9hjZ2kwNicPEXrXnl+
 HIcQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version;
 bh=hcuTuKk5ozc7mP++rUuLppfOeaAZQS4iv/G7FilvjJs=;
 b=SuHg7A7Gx+XtjNktkxD43zmHwSgT1HFXJMs/JQErJuZsWHpSMC3VrL6hBWcI7zoIav
 /fyUMwGHah43KlQYijvZHLfo69WpU43LvEWOvc17bUARDFWlS8pv5ZfGr9Cfxrj63dSs
 JMAtEcqdGy82le6wDMWRmbjAZLfDigcTgUIEBawVeh89GCKEcHGe2dZN6mQ/SdRo6QEO
 kHd99hIf+RoFVyBbnp5kJSdiRiP4eg02gvwxmqamSFuFoYkxKRB/e+RZkRpWI4374G51
 DGELv977z+alC6QJJZJr8/E2sonTa5GUWw89+fRCKaDW+2uboZMErZJOt0FG0G5407hN
 J6fw==
X-Gm-Message-State: APjAAAWBVfIuwDbHuK3bVE2GRswZjq3nPMFspYDfaBa7FRFkiNQSLznF
 FMi7AH3VQgu2i3DfqBGPJBHSH6Oi
X-Google-Smtp-Source: APXvYqwVRqzv8aTiX+1S+lo2JzGSDnHDf6+2/cZzm7+HA9krTKoTXD9aS6b91RBtGkOUGNMgRXiGkA==
X-Received: by 2002:a1c:9c4d:: with SMTP id f74mr9759282wme.156.1560078523505; 
 Sun, 09 Jun 2019 04:08:43 -0700 (PDT)
Received: from nc10-laptop
 (2a01cb04010fc800bcce02c98b58d624.ipv6.abo.wanadoo.fr.
 [2a01:cb04:10f:c800:bcce:2c9:8b58:d624])
 by smtp.gmail.com with ESMTPSA id c5sm9054246wma.19.2019.06.09.04.08.42
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 09 Jun 2019 04:08:42 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: 35564 <at> debbugs.gnu.org
Subject: [PATCH v2] Tweak dired warning about "wildcard" characters
Date: Sun, 09 Jun 2019 13:08:41 +0200
Message-ID: <87wohvf22u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: Stefan Monnier <monnier@HIDDEN>
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: -1.0 (-)

--=-=-=
Content-Type: text/plain

Hello,

Here is my second attempt at solving this issue.

To recap: dired-do-shell-command warns the user about non-isolated '*'
and '?' characters since the function will not substitute them.  It
refers to these characters as "wildcards", which can be incorrect: they
may be quoted or backslash-escaped, in which case the shell will not
interpret them as wildcards.

My main motivation to change this warning is that it trips my brain to
have to answer "yes" ("yes, I want to use wildcards") when no wildcards
are involved.

I could not come up with a simple, self-sufficient rephrasing for the
warning, so I decided to display the command itself as part of the
warning prompt, highlighting the non-isolated characters.

The first patch adjusts y-or-n-p so that it preserves the prompt's text
properties.  The second patch changes dired-do-shell-command's prompt.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Preserve-text-properties-in-y-or-n-p-prompts.patch

From 1719809f75183dcc743f2bdf697c919ae859b82f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:03:59 +0200
Subject: [PATCH 1/2] Preserve text properties in y-or-n-p prompts

* lisp/subr.el (read--propertize-prompt): New function to append
the prompt face to a string.
(y-or-n-p): Use it instead of discarding potential text
properties.
---
 lisp/subr.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index fd60ec87cc..1fcadc291c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2334,6 +2334,9 @@ memory-limit
 
 ;;;; Input and display facilities.
 
+(defun read--propertize-prompt (prompt)
+  (add-face-text-property 0 (length prompt) 'minibuffer-prompt t prompt))
+
 (defconst read-key-empty-map (make-sparse-keymap))
 
 (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully.
@@ -2671,14 +2674,14 @@ y-or-n-p
           (let* ((scroll-actions '(recenter scroll-up scroll-down
 				   scroll-other-window scroll-other-window-down))
 		 (key
-                  (let ((cursor-in-echo-area t))
+                  (let ((cursor-in-echo-area t)
+                        (prompt (if (memq answer scroll-actions)
+                                    prompt
+                                  (concat "Please answer y or n.  " prompt))))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read--propertize-prompt prompt)
+                    (read-key prompt))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0002-Tweak-dired-warning-about-wildcard-characters.patch

From 69b8dfc60f8aca1a6f5358af6fdf60ce3c910cfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Fri, 7 Jun 2019 17:19:44 +0200
Subject: [PATCH 2/2] Tweak dired warning about "wildcard" characters

Non-isolated '?' and '*' characters may be quoted, or
backslash-escaped; we do not know for a fact that the shell will
interpret them as wildcards.

Rephrase the prompt and highlight the characters so that the user sees
exactly what we are talking about.

* lisp/dired-aux.el (dired--isolated-char-p)
(dired--highlight-nosubst-char, dired--no-subst-prompt): New
functions.
(dired-do-shell-command): Use them.

* test/lisp/dired-aux-tests.el (dired-test-isolated-char-p)
(dired-test-highlight-metachar): Test the new functions.
---
 lisp/dired-aux.el            | 49 +++++++++++++++++++++++++++++++++---
 test/lisp/dired-aux-tests.el | 27 ++++++++++++++++++++
 2 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 51749acb21..dfb793324f 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,49 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((n (length command))
+        (whitespace '(?\s ?\t)))
+    (or (= n 1)
+        (and (= pos 0)
+             (memq (elt command 1) whitespace))
+        (and (= pos (1- n))
+             (memq (elt command (1- pos)) whitespace))
+        (and
+         (> pos 0)
+         (< pos (1- n))
+         (let ((prev (elt command (1- pos)))
+               (next (elt command (1+ pos))))
+           (or (and (memq prev whitespace)
+                    (memq next whitespace))
+               (and (= prev ?`)
+                    (= next ?`))))))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted:"))
+    (format-message "%s\n%s\nProceed?" prompt highlighted-command)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -759,11 +802,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (y-or-n-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..77a4232aac 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,33 @@ dired-test-bug30624
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/plain


Sample screenshot:


--=-=-=
Content-Type: image/png
Content-Disposition: attachment; filename=dired-warning-highlight.png
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAbQAAAAqCAYAAADbL67BAAAABHNCSVQICAgIfAhkiAAAFnZJREFU
eJztnXl4VFWWwH/vvVpSWSsrIRsQloR9MS4oLiAuDOCGuHc7PePS3d/Xduun6LRM09ii04rtzDi9
zOjnfLbd/bWCdtOiDSi2tIIKCcgW1oSQkBBSSaWSqkpqfXf+SIAAqVeVIgnL3B9/kffOveeee+49
995X7zzlkksuEZyPKBa0xBSUsJuQL3CutTl/GGy7yH6QnI70iQubi7j/1HNau7mU7PvfZcJPNzPl
+U2MmJTQ49p1FC5ay/gFs86xkhHQZjLsJ1uY9OAtmJRBLLOvdolYpor1mreYvKycKcvKmfKTZaRp
A1lf/6FOeYXJy07zl74yCHpetJzhE0a+FKOfnQ9kfovRz21m/K2Xcc5dYiB1OQ/n1n4Z08Qa0JQU
bJc/y6gnPmHS0s+Z8Pgvyck/e69Uiu8hd+xw9H2/pvb953HUno+rBSv2ezcxZel/kGE7527ejwiC
+16n9v3lOI+FB7Hei9WeZ8uFbBcjX5J+NvjE2/bBlut/TNFvUbBMe46R82egdRzAvfco6tCJJNpV
qD8bB1XQkjNQCNKx8/c4d50WzALrqFmy7izKv0jpN7sI9GNf0NqUgTbxMTLsA12f5KLhDJ8w8qUY
/UwyeFzEYzp6QFNGkjF9OqbQDhpef5QmRwi0bMwJIUBBzbuDgvnfwZ6XjmjbjnPdizTsqkNoMxn2
7EvYHWtwBqdhL7AQqFhG1QefEeq+lm7tiub2ezcxhQBt78zi0A4z6Q+sZdhYCwCicjE7f78G/bg6
pUsZ/8CNBMrfJlBwK6k5SYQr/43alm9TPM6Jx1SKzb2W1o7pZBQHca18mLpKZ1zGUSe9xMS7Z3Vv
+a+iaPEWioQL51tzqK3u1scygZwHHyJruA3/8fahoOUtIH/+g6TlZYJnH22fv0z915WEY3hi2XuZ
KQZ20TBPeJLh8+Zh0/fRsqeTjMvL6Fx9Kwe3GJVpRP/XpxvZ80DIwGY2bNOXMGzW1Vh8X9O0J4GY
H/xqhaTd8BRDp07DYukkWL+WhpWv0OY2sItiJ2XWEvKmTsSSkoTiq8Oz9TXq1n1OUETywWXsffdL
EmdGlouki7vo53HaxUCXd9agjvouhf9wO8mZyYjOJny7XqPmg/UEI9lKLSP/qddIKX+Qvev3n/TH
0YsZ/8Bomv7zMYJz/hpxbPY7RnOIwdyjGPpZxNafbG/SFeQ9tJTMfAXf9l9Q85d1BPR4x7SCeXSE
fki6jeJFz5Jc+TQ739lAwvVvM2ZmIs3/cyf1XmNdIpUZNmx7QsQxbTjXNcyNqOdR+wsDN6YTh5GY
mYJwH6LT5Y3JZaIfOVpLsGVriIb1uBzdU2DYQdArIGE6+Q88TXq2E9fGFXjCk8ha+HOG5JtPdmfu
GNj9Os4GC7ZLHyIzR4XwHpr/8hxHKg4iRJCOr56n9r3jR44+vJuep/bP79ERcQNoInHKbJT9b1L/
4Ru4Grsbm27Dv6MCUXQbKf4PaWvLxz5patznxHrtu9S+t4zm+hCE9+P8YCm1771ES+PJUKAUXkli
y2e425JOts92DfnfWkSGvQ7nJ7+i5Vgm6fOWkz86OaZ6ey3TyC5JN1Fw2wIStWpcu+pJmnw5mhJL
mUb0f32G9jSyWdZCCm6+ngR9D659QdLKymLsUzOJ1y9n+IzL0BxrcGxcjSdcTGLKyePy3u2Siq0w
B3/l7zi66iUcDcmkXv0suaOsPcruzQeN5CLrErddjHRRJ5N963dIUb7i6IqfcOTTj/CJRBSjEyFx
GL9DYMnKR1VTsGQVYbaomDILUYM1+No6Yhib/U+vc4jB3BPLuDWoDW3sXBKd62lvScBW9gz5k9Lj
H9Px9EM0XQzKNG575DEdr80GbkwrqCU/YtR336T46tKYnyNG36FZkzEpCnS6ON2H1RFzSEsN0/HR
M9RuakDZIyh99H7SJ5ZyrLHrHlG/isYvV6Go88gqKsKSqkFTI95vVuPXbiBvWiGB6g9x7j6+ctIJ
VH+E80iI1HkLsPWqlMC/eSk167Z3R3UN2+zvgWcHrVsOYZ1xGeHdv6dNuR97cjqaAnrufYy45UbM
CkAY31fPUvtNt5JDI1xzldO6dSei5CmyhjjwbF+Ns7N7HdE9J4qGd6lb/TbMmEDqTQVYUjXUIXOw
p4TwrHmZo+XNUBnCNvIJ0iZOQdn/RdTdRW9l0hSMaBd1+AxSEnQ61i6m9vMjWNoLGTtnbAxlGq2t
B6C+g5HtqU6MZLOpmGvKsGlB3J/+C7Vft2IL/JEx1+ZFsSKgTiB98ggU10oOv/USniCACop+YinX
u12O0vyHB9EDOorJiuIuJWP0rdhyc+BA3fEWnuaDAObIclVZkXUR8dily5ci6qKWoWigaJmYLF48
e35L69c+Y3uJVnyOVpT8QsyFkyh++B6Cf72bYxkFKM0b8YUj+8RA0tscomYazD1rDMZtLPUdeoOa
91cQHOqh9Pv/RHLxOLRwvGPa1Pd+iKKLssMfuUyjOctgTBvKJRkoaCA3IGM6CtEDmt9DSAiw2VGh
R1BTUJMzUAngdzoAEK46gmEFW0r6ibuE34NQgHAIUGNcmUQjTKi18QwnEgiUsI44/k8IUDUUAYo1
D1vhBCwKQAgqT662ja5FQ3QHeiUYoKt9CqaUTBTFQvKcFUyac/JePTkTTYFQlLF1ZplGdytoiXYg
SLClERAEW+oR4rQA06cyB7s+I5tlYUlKRsFDoMUFhAm01COIJaBlYE5S0GsO4Dux0NTp6Ti96mke
Tvq8f2HIxPFYLMd3c2FClp6/wOrFB43kYtClb3bp8qVwJF30bTg+XEni3FvIuf1yhuDBt/UFqv60
ruv4s1fC+BoPw4RhJBcMRfN60PKmYE1MR3dUG8gNLGfOIbHNPXHWhu6q7zqOb63Dr6tYbWmY4x3T
Rv0Qly4pKPpXcfTtYHO2Y1qgb3ucHdv6Vmv0gBbYT2ezTlreTOxZ7+JoDoGaiTnBSdjjRMeCNTMb
aECxF2BWBSF3K5DVN036iBCx9lzXTCpqllO5eHnvZRlc65pxBKDEGAQEYU8rugjQ+dkiGqs6T17p
PBzTM7S+IQj73AhMmO3ZwFFMGUP7ELCC6GFAS0A1wRnb8H6vrzd7GtmslkD+TASJmJMTAC/mlIzY
jiB0J0GvQM0ciVWDUAi6/MGoExRME79P/rQJhPf/NzWbthHKvodhc689syWn+GAUuai69NUup/rS
meMhTGDXSxzY/SqmrKmkz15M/tSHyfp6PUcj/phLEHZUE7SOI3X0ELzlqzGXzCbVKvBV1cTw3NLI
l/rqZ0YIdMO5p+uevo3b4yho9lxMCgTT8rAoOnpnG6G4x7RBP7TqKICiaigoKJbE0/y6N13ciKh9
G2/bI8iJaHoO0JhOGkFiViqivYrOVk9MLYge0PSDtHz5Ndm3TSfv4TdJrj6KmjeZ8Lr51FStpd19
E+nXvUBR0ja0sXdiEdU07diLYEZMCpxBwmjSxpaimbp3TPZppE8zo3fspX3fgYF7AB0RQcjThtBK
Sb/mTjjWhu/gx3g7IkuEq9bh9l5H6pS7SQtuJKCnYM67FMvhpdQ0xqmGkV0Ob6IjMIuUa5dQYKsm
4bJJKLHOGKITX3MTlFxC9pz7UGpdBA+vx+0tGpj6ItnTyGZVFfjC00me8RhZSj0pl5agRPlJCwD6
blw7asi6egHDvq3hPOTBVFRK6NPHaWww0FB0DdBwSyXeJg8pU0swK0St0VDOSJe6UHx2aSRyYFfH
krPwPkx1W+hoC6JqKhBERFlRCUc1fmUBqcMP0Ljma8xT7yYzpQNn07GoYzMcyZda/JH9rMUfxaq9
ox8ymnuIbE93DCvK4f9M0bx8Avm3k6B6aa+uJFRli29MG/WDv4mAT6AU3UzWlFySJuQBpzlmL7qI
qH0boe3BUVH6L9JcF03PgRjTCuqYxxh151WEv/oelR9UxPRDsBierQuCFYupWv0B3kABqeOvwqZU
0eHSwbeR+t8tp7UlB/uMu0nSdtG8chGNDdE30xFJu4bc25dQdNsCEjVQ8u6gcMESimZfhzm69AAQ
xLv5DdoadWxXPkXhgkVk5kZZB3jXU/v2y7hcBWTMepy82fdiT3fR2eSOXw0ju7g/5MiqP9PBBDKv
mETgwDZ0AcS0iw3R8eVrNB/pJKHscYoWLGZIcfIA1hfBnkY2c6ygbu0Ggva5DJ19OYGD22Nybgjg
Xf8ktZsq0IfewpBrF5BqPYLPbRR8BeHdv6Fhx0FMl77KuB88T5rpWNRj4uhy0XSJwy6G6ngIBnJJ
veYJht3zU4YUemn77FUcx6IsCTsP4XNr0FFJh6MSb4OOImrxOUIxjM0IvhT1WhxEnXviGLcACMJ7
19CZO4f03BC+rS9Tv7N1YPohXIHj0w34rdPJnVVGuOHIaX4dQZeofRuh7VH7L4JcVD0Hc0wbo5y3
qa8kfUDpPr3q2vZrU19lwoJLaV95E4e+iW2rfn7XJ5FIJNGJZckiOd9R0sm46xekeb+kw5NEUtnl
KOFKPHUG56IXUn0SiUQSAzKgXRQECLaDbdq3SE1Q0Vt30vynF2luGagnjoNdn0QikURHHjlKJBKJ
5KJg0JIt91c2ZYlEIpFIeuN8+XrAmWT/I2Oe28SIKYnxyVtmULToE4ZPtAOC3LwGXrhhFx8v3Mrn
t+3hhRJv7y/AnyLXTe6jlP5sE8WXGLy02Zvc2bZBIpFIJDFz/ga0s0LBNOku0sJrcOxxAYIxRS2M
DKTwwd4cvgz4uGFKHQtSTj9tPV0u3vokEolEMtjE9PmYiNmiDbPKn0WG9Lh06YE6iqwrpuDf8gu8
IQCViopx3BvU0BGU0M6140R37kYjuRiJV04ikUgk/Ub0gHY8s3NoDQ0r/k4osZjk7O5s0Qnd2ZQp
x/HJO4gRd5E9bzk476LWeUdXNmXfdpz7gqSVzUCNJbvDcdwbObbKSbjnRz+NdOkRLdXihWSkbaax
4vCJv3mDGiDIGHqEJSV+6qqLeb/91IjWm1wsRJTrrQ0SiUQiGRBi2KFFzhatjhrAbMq+A7RVHIhZ
lxMoWdinz4YdT+PynronVFMcvHiVg6QjI3i4PI3WGOUIdhIWAj3QS5ZsI7le2yCRSCSSgSCGXI6R
skV/jDIQGdLj0qVHlunsW8gaUU/LbyrOyPtoz2ljoimBt/baaTr9/NNADm8zYd1NuKOXHaaRnEQi
kUgGjRh2aJEzOzcNRIb0OHXpyjKdQPLlt2E59DpOx5nhJdiexnsHBN90nq6JsRz+z6j75U5E6+k5
KqPISSQSiWTQiOEZWuTMzoZZ5ePNkB6nLgAkzSJ7korrnU96/S6QZgkwLEVnp9aVg/AEUeSwzyR3
7k2ENv2Yo/s9sctJJBKJZNCIHtC6MztnXPME2Uk2REfNyczOoiubcsHN95Ex63FUvASPltOy5Xg2
5YkMnzWXobO34zy4HVE2/uy0NdIFFeu0u0hu+wsHqzt7E8aS1MGlQ3S2ntLqaHKAtYCkkWUEdpr7
JieRSCSSQePiSX1lmkb+D1/BuuEuqssd56+cRCKRSAaEiyc5cbKVQMXLOHf0MbgMtpxEIpFIBoSL
Z4cmkUgkkv/XXDw7NEm/Ul5eHvFaWVnZIGoikUgksXGR5nLs/+z+6vAnGPvTP5A79AJcA1imU/jU
BkbPGHGuNZFIJJIBI/rsbJtP8TNLSDUJEEHC7bV4K39Lw9qP8J3+WtZ5i4Kl5BGGXjeHlNwcVH81
7X9/kdovd6PHcuCqFJJ5w+2YDy2npfECTNYY2Ezz1nrGXPMI9q0/xtUhT5klEsnFR8w7NNH0N5r+
vpL29gxSr/hXhl01ciD16mdMJEycj61zC86Nf8TdOQz7zU+RlRFj8/NuJbNI4Nmx4QJ93yxM545P
6Ey4luzJuedaGYlEIhkQYj8/a/qYo+s+RmQ0YfnRj0gsKEGlClG6lPEP3Eig/G0CBbeSmpNEuHIZ
e99Zgxh6BwXzv4M9Lx3Rth3nuhdp2FXXlUdYKyTthqcYOnUaFksnwfq1NKx8hTYXBhn8483uH8Kz
+l72+tyACRtXkXqNGUWLpeEqCSVXYhUHaKlpO/E363VvUTo7D9cf5nO4sgOSb6X4ycUkH3qeyt+u
IhQx8CmoeZHtokS0518JRypTm8mwZ1/C7liDMzgNe4GFQMUyqj747OSr7C1b8bSbyC65AtNXfzLQ
TyKRSC5M+vgMLQFLYQkWVRD2e3oEDBOJU2aj7H+T+g/fwNXohYTp5D/wNOnZTlwbV+AJTyJr4c8Z
km8GzCRev5zhMy5Dc6zBsXE1nnAxiSka2Loz+NvrcH7yK1qOZZI+bzn5o5ONr2Ut7Mrur+/BtS9I
WllZj8YJdJ8bUDCN/iFFVxbir/g1zTGlq7Jiyy0C/2H87cdbrOPf+TGdegrJYy9BRUEbdTXJpk48
uz43DhaGdjGwZwwouWNg9+s4GyzYLn2IzJwe3StqCbSEUHJGk3D2OcgkEonkvCPmHZoy4UUmL+v+
T7CKpi3lnEwgJfBvXkrNuu0ngpw69mekpYbp+OgZajc1oOwRlD56P+kTSzl21ET65BEorpUcfusl
PEEAFRQddUKkDP5T0Kxnmd0/826G37sQrfLHHPjgi8g7nlManoiaoKL4vac+b2v5lNYj3yVv9LUk
mbehlUxDCVTg2tsasSgAdcScyHap39l915n2jAVRv4rGL1ehqPPIKirCkqpBU3fQFh2E/EBCMqoM
aBKJ5CIk5oAmmj6ladd+wp5avPs/x9vaM91TmFBrY4/JV0FNzkAlgN/Z9eKxcNURDCvYUtJBNWNO
UtBrDuA7cSamg1AwRczgn4019Wyy+yuYimeQaK6h6YsNBGPNJSx86AGBMNu6vrt2gnradu4ib+6V
2Ed9hTIyGVG9njbDH1xEsUtEe8aoqt+DUIBwCFBP1VdJQDWD8HfKrwJIJJKLkj49Q2tc/3HESVaI
nlcEuseJjgVrZjbQgGIvwKwKQu5W0E0EvQI1cyRWDUIh6NrrCcIRM/gfJpAz/ayy+wvHF7R8bcHr
7suU7sPXdBTGFGBNUnCfOHYUBHavw3PTIlJvfAQl0Ydn98You74odoloz35AySchQ0O0VOEP92/R
EolEcj4wYC9V6YfW0u6+ifTrXqAoaRva2DuxiGqaduxF6AquHTVkXb2AYd/WcB7yYCoqJfTp4zQa
ZfDfeXbZ/ZWEXKxZVrQ+tTqM7+BmglfPIakoieZdPbLtuz/DdeiHFI4pBv8GXPtcZ2cX6IdP7EQg
bTJJ6QLf1s1cMG9bSCQSSR8YuBerfRup/91yWltysM+4myRtF80rF9HYEAQCeNc/Se2mCvShtzDk
2gWkWo/gc4fB25XB3+UqIGPW4+TNvhd7uovOJrfxNccK6tZuIGify9DZlxM4eObzJ8VeSkrxeKyW
voUNUfNnnE0JpE68Eq2nqGihbWc5uhDoVZ/Q1hnDrsrQLgOFgnX8bBJDm2nZdngA65FIJJJzh8zl
GBMKpnE/pWRhHk3/9SiOlpNHlmrpEsY9MBPPiluo2d5+DnU0wDSRvB/8htRdj7Dv490xPZuTqa8k
EsmFxgWYx+lcIAhVvsC+f89AHN+FJY0jrXQaadNnY/L+jdZ952kwA9AP4fjf2zjmdvT5hyYSiURy
oSADWsz4CbUdPfE/Zch8Cm5fgNa5n+ZVv6LNdw5Vi4buIejyRL9PIpFILmD+D/3VPFWF5Qo+AAAA
AElFTkSuQmCC
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


I am not sure these patches should be applied as-is.  Some things I
wonder about:

1. About read--propertize-prompt=E2=80=A6

    1. Should the function return a copy of its argument instead of
       propertizing it directly?

    2. Is it properly named?  Does it fit in subr.el?  I placed it there
       because I figured other users of read-char in subr.el could use
       it, e.g. read-char-choice.

2. dired-aux.el already contains some logic to detect isolated
   characters; I could not think of a way to re-use it, so I added my
   own functions to find *non*-isolated characters.  I added unit tests
   for these new functions; still, there may be some redundancy there.

WDYT?


PS1: I am still absolutely open to simply rephrasing the prompt=E2=80=A6  I=
 just
cannot come up with good alternatives.

PS2: CC'ing Stefan to follow up on the discussion on emacs-devel.
<https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00339.html>

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 9 May 2019 20:04:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 16:04:35 2019
Received: from localhost ([127.0.0.1]:36527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOpHP-0008LB-Eq
	for submit <at> debbugs.gnu.org; Thu, 09 May 2019 16:04:35 -0400
Received: from aserp2130.oracle.com ([141.146.126.79]:39130)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hOpHN-0008Ky-O3
 for 35564 <at> debbugs.gnu.org; Thu, 09 May 2019 16:04:34 -0400
Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1])
 by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49JxCrR098810;
 Thu, 9 May 2019 20:04:27 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=aVjGFvQteozmOSoHWXUyw/hi3DzxOQ9APdXoidGpm+w=;
 b=0n+RzhV8HYh6iF2+YjYI9Tx+7RAdOq2Ez5CjhPFhbtGuvTp9V9km9do7LnwOEifTorgQ
 V7RWfUzYzTZg5ySkAuzjgSmlyn7SERoSGVtlSCm1a/tUz0UXZAjqqX6ZlMRdnPmnsUor
 H0f5wd7YcOBjy5WZ71mHU8UyqpLCFh/+rOiqEf1cVvdgWsZ9cWvoPkP4tcisGctTj3Fn
 auzw8UyUXUnkizmWpu594SNw1HM5WM+oBZWnStUsUa+zM9ugfyGSrn/lxBC6eSnunV0u
 /oRV7BPvze+HZ3mVXFq+UrgPxkTwC28Dg+D0jYiTXCdUNPyhfGV7x649p83d1pADKunZ DA== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by aserp2130.oracle.com with ESMTP id 2s94b6d948-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 09 May 2019 20:04:27 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49K3Tqj109724;
 Thu, 9 May 2019 20:04:26 GMT
Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])
 by userp3020.oracle.com with ESMTP id 2s94ah0ejq-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 09 May 2019 20:04:26 +0000
Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20])
 by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x49K4Pu4005899;
 Thu, 9 May 2019 20:04:25 GMT
MIME-Version: 1.0
Message-ID: <ab136991-95ef-42a1-8b42-edaa8f582413@default>
Date: Thu, 9 May 2019 13:04:24 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>, =?utf-8?B?S8OpdmluIExlIEdvdWd1ZWM=?=
 <kevin.legouguec@HIDDEN>
Subject: RE: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default> <877eb0ptiy.fsf@HIDDEN>
 <fcab1f4d-4eb3-0765-d546-aa7fe060549f@HIDDEN>
 <c29e2a4d-7913-4498-9431-1fddafff6bec@default>
 <e991a50d-6231-b2ba-06d4-084f4a6a9996@HIDDEN>
In-Reply-To: <e991a50d-6231-b2ba-06d4-084f4a6a9996@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4834.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1905090114
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1905090114
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -3.3 (---)

>  >> But I'm afraid we'll have to stick to what we have now.
>  >
>  > Why?  Not sure what you mean.
>=20
> I mean that it won't be easy to convince others that we need a new
> face for propertizing prompts.

Why assume that?  Who needs to be convinced?

If we can't have a new face for this then I'd like
to see non-minibuffer prompting have no face at all,
by default.

>  > I would prefer that the two be separated.  Tooltip text
>  > is quite different from prompts in use cases and behavior.
>=20
> They are similar in the following aspect: Both prompts and tooltips
> are often displayed using toolkit functions.

That sounds like an implementation thing, not a user-level thing.

And as I said, `x-show-tooltip' has no problem with
showing propertized text.

> GTK tooltips are by
> default not propertized because the system doesn't accept any face
> properties for them.  If Emacs used balloon tooltips on Windows,
> propertizing them would not be possible either.  And both 'y-or-n-p'
> and 'yes-or-no-p', when implemented via dialog popups, don't adopt our
> text properties either.

Oh, so `x-show-tooltip' only supports properties on
some platforms (e.g. MS Windows)?  If so, that's
unfortunate.

Yes, I don't expect window-dialogs to respect
propertized text.  Again, unfortunate - but livable.

> The question is now whether an application should accept the uniform
> appearance of such objects as prescribed by the toolkit used and as
> such obey the toolkit's look-and-feel or insist to use its own
> implementations.  Emacs leaves that choice to its users.  Which means
> that users are told things like "if you want this mode to behave as
> intended, you have to customize variables like 'use-dialog-box' or
> 'x-gtk-use-system-tooltips'".  Nothing bad with that, but some users
> might be uncertain whether they should agree.  In particular when such
> an option affects all sorts of tooltips or prompts.

Got it; thx.

I would like to see Emacs allow, when possible, Emacsy
things as much as possible.  But I can understand that
there can be some tradeoffs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 9 May 2019 17:51:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 13:51:39 2019
Received: from localhost ([127.0.0.1]:36326 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOnCl-0000lm-F7
	for submit <at> debbugs.gnu.org; Thu, 09 May 2019 13:51:39 -0400
Received: from mout.gmx.net ([212.227.17.22]:59353)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1hOnCj-0000lW-9L
 for 35564 <at> debbugs.gnu.org; Thu, 09 May 2019 13:51:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1557424285;
 bh=lYckT3R96aEQXwwZZuoCSk5P7gBkn/Lpt6bNeYpaWfU=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=BmglLR1LxkzlM8zcqD4QInZEGz9kFlsIBCiOL7S5vu449yFq4QR/nSDbeqRybubyt
 iKdOCo9hNKQd5kBa5eSp2y7jK2HGm47t4hxggzEev/lWaqYNFazQzZme9wvqOu5CxI
 2w2FY4zEnwrK7g9wDE465WI9dMsFPxizcpn0hSfw=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([212.95.5.238]) by mail.gmx.com (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCbIx-1hYNzT43Tn-009jZq; Thu, 09
 May 2019 19:51:25 +0200
Subject: Re: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
To: Drew Adams <drew.adams@HIDDEN>,
 =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default> <877eb0ptiy.fsf@HIDDEN>
 <fcab1f4d-4eb3-0765-d546-aa7fe060549f@HIDDEN>
 <c29e2a4d-7913-4498-9431-1fddafff6bec@default>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <e991a50d-6231-b2ba-06d4-084f4a6a9996@HIDDEN>
Date: Thu, 9 May 2019 19:51:28 +0200
MIME-Version: 1.0
In-Reply-To: <c29e2a4d-7913-4498-9431-1fddafff6bec@default>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-DE
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:6QXMBTrZ3SNfCrsH6NtjX+SnxwRoUorAM+9AgLcaGks+/6Rq75u
 mTXxT6NWekLrHc5J9CK/a9hxeyHuEU34/NaQFl3J/Q4FezQITw5KM70s/iKmiRGLhOaap7q
 6y+D+/5swr/Xi6i6BW2kDp9SKmPLp1qVVBI+ejWIrMs/rEUtUjIATNHJ3NY4S8ZZy+j+L34
 URdLfcCmvMiIrqNNc8A+Q==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:TrAsbbDW65c=:QpgIQ7b/Hcgrdju0gvdhv8
 HCnj+ie+KlZ6HJuUgz9QLNO2Sv0auU4kybGxM5iZMI0K0uEr07XGdTeKKZkvyPjzBcvqO/89i
 ZJ5D6Pzu3f8M5DAOMi4AWSQiEYAOUIRIpuBHS2tg4d/iccrHR+uS74vhmuhiNYw5fdtbZJjcj
 YiQ8Qx18d4MRyV8SZD9iGaf3wOuCw4AkwrrBkOtNclm/RvPb6Sw752ouSet/kXcmhg6EDrqZ4
 b5hK4L7yIi2uLAtMMu8So8Orc46JO/1TJwMhpbj4Mo6qF44JEklnaZGJkYP/EYU3p4lhWL0cm
 PpWD2c3jdha1tPWfHQz5GAP0BG7tj5CT0pvHrhXfK6ZMcsnh0gTi9woR4tqfNt4pghZRApt/R
 anrTGx0kDjUMwvoKwQmPOL2rI1+qzbP5NhxF9N8s78OplBndIeWay/8ilfxfpeD2mRmZAdnd8
 IcbGY7R+BfGXexjcqEttyVfYyE405wZHArffC0OyKJf3KJinEHt67tDqw2AhjDUedqTXw1LNW
 TyXdk8a+/wOrZ3H2z2G6DFpBqB+nk5eRqiuZLyi7/PE6a5fQVptPK/J8oeXzc8lSDvrLJKOve
 RH3wKOIM3rGNpdH6WsqUfBSwz7+XccGOHqtftd/e7kFZavULFHQA1lpKtr0UEWsIAQ5R+LPAL
 xvoVIfn7V7XgCZP9lt8VX/oNSz3/aBtSvshRJj9ETAle6Qgvmt92UuvuxZYnxdkkFLoQLrtKm
 7QZg6g6IFomLGXUEVO64wYGFi8HVzO0YfixIun/vgeZgfJCrSRNMoanjk83sm3eAMZSrjgc6E
 ItxXVF3msAIB2zAr9rhNp4kMW2NGHVhPEZjgZG7XgqNz1uD8kIjT8znsC6/Uy1s9xGz9GpgBG
 JA4fuH9Swjh3MHqOJDfdokj1HrriehzE7IUafgAVoFclhYf57o+ZfPz+WCpx72B9ZMChpfbxK
 p0Q+J3rubmA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -1.7 (-)

 >> But I'm afraid we'll have to stick to what we have now.
 >
 > Why?  Not sure what you mean.

I mean that it won't be easy to convince others that we need a new
face for propertizing prompts.

 > I would prefer that the two be separated.  Tooltip text
 > is quite different from prompts in use cases and behavior.

They are similar in the following aspect: Both prompts and tooltips
are often displayed using toolkit functions.  GTK tooltips are by
default not propertized because the system doesn't accept any face
properties for them.  If Emacs used balloon tooltips on Windows,
propertizing them would not be possible either.  And both 'y-or-n-p'
and 'yes-or-no-p', when implemented via dialog popups, don't adopt our
text properties either.

The question is now whether an application should accept the uniform
appearance of such objects as prescribed by the toolkit used and as
such obey the toolkit's look-and-feel or insist to use its own
implementations.  Emacs leaves that choice to its users.  Which means
that users are told things like "if you want this mode to behave as
intended, you have to customize variables like 'use-dialog-box' or
'x-gtk-use-system-tooltips'".  Nothing bad with that, but some users
might be uncertain whether they should agree.  In particular when such
an option affects all sorts of tooltips or prompts.

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 9 May 2019 14:20:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 10:20:07 2019
Received: from localhost ([127.0.0.1]:36015 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOju2-0003xm-T8
	for submit <at> debbugs.gnu.org; Thu, 09 May 2019 10:20:07 -0400
Received: from userp2130.oracle.com ([156.151.31.86]:42306)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hOju0-0003xD-CK
 for 35564 <at> debbugs.gnu.org; Thu, 09 May 2019 10:20:05 -0400
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49DwspX157416;
 Thu, 9 May 2019 14:19:58 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=2aRX+hBrV1wwj6HpOAHsb65kqC8Vy9ojq6HsM7CPBZM=;
 b=QxVSrPzrV2l4Cl/ODSXEGa9RdC1BBR8L4ClgTClEUwC72xjs5slQIjOwEcb2ppVeclEh
 KNhOtNrFCDDmtmR/u6RuZeCm8xYPsILluCXpSsHt0RniT6MHKu6348c3dl9wBGQbAqsx
 mI4k2RpiBCSHOpnRKixhwiqbINH/Umzw+d7hPN8rf540rC8TOrsHMTQUvPou//8zED3X
 xiQwWQXxJ76Fc2G5U2njHQMjd55xMDai5LtT1m7hLNIGfo10i7ALbMG/5dSZSqWTptNN
 okbzwNQI4z00CSfcChvQDRhzXxIen6i4LTUL7AiDSbnCMG+hQOlQ3xPzJKjlMgfZBeGm fQ== 
Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80])
 by userp2130.oracle.com with ESMTP id 2s94bgb619-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 09 May 2019 14:19:58 +0000
Received: from pps.filterd (userp3030.oracle.com [127.0.0.1])
 by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49EHwPK170957;
 Thu, 9 May 2019 14:17:58 GMT
Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])
 by userp3030.oracle.com with ESMTP id 2sagyv91re-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 09 May 2019 14:17:58 +0000
Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20])
 by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x49EHr7Q026948;
 Thu, 9 May 2019 14:17:54 GMT
MIME-Version: 1.0
Message-ID: <c29e2a4d-7913-4498-9431-1fddafff6bec@default>
Date: Thu, 9 May 2019 07:17:53 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>, =?utf-8?B?S8OpdmluIExlIEdvdWd1ZWM=?=
 <kevin.legouguec@HIDDEN>
Subject: RE: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default> <877eb0ptiy.fsf@HIDDEN>
 <fcab1f4d-4eb3-0765-d546-aa7fe060549f@HIDDEN>
In-Reply-To: <fcab1f4d-4eb3-0765-d546-aa7fe060549f@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4834.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1905090084
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1905090084
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -3.3 (---)

>  > (Perhaps those clients could be migrated to a new face,
>  > e.g. 'message-prompt', which would inherit 'minibuffer-prompt' by
>  > default?)
>=20
> Simply 'prompt' would be more intuitive since most messages do not show
> prompts.

Sounds OK to me.

> But I'm afraid we'll have to stick to what we have now.

Why?  Not sure what you mean.

> Note that this isssue also touches one Drew raised elsewhere - whether
> 'tooltip-show' should retain face properties of the original text or
> show text uniformly with the 'tooltip' face.  Maybe we should
> introduce an option like 'prompts-retain-text-properites' so users
> have the choice.

I would prefer that the two be separated.  Tooltip text
is quite different from prompts in use cases and behavior.

Wrt tooltips, I also don't see why we need an option, or
even a defvar.  Tooltips should just accept and respect
propertized strings.

When you use `x-show-tip' there is no such problem - you
can apply properties as usual.  It is only `help-echo'
tooltips that do not respect properties (AFAIK).

Another, simpler possibility, for dealing with face
`tooltip':

It is not possible to simply _bind_ a face for the
duration (or lex scope) of a function.  But if we
use a face variable for this, e.g. `tooltip-face',
then it should be simple to do so.

IOW, work around the limitation that you cannot bind
a face by binding a face variable and using that for
`help-echo'.  That should make it simple for any code
to control the appearance of the tooltip text.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 9 May 2019 08:13:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 09 04:13:16 2019
Received: from localhost ([127.0.0.1]:34615 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOeB2-0001Bd-JW
	for submit <at> debbugs.gnu.org; Thu, 09 May 2019 04:13:16 -0400
Received: from mout.gmx.net ([212.227.15.18]:33521)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1hOeB0-0001BQ-9F
 for 35564 <at> debbugs.gnu.org; Thu, 09 May 2019 04:13:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1557389583;
 bh=+XoNa+viqVNcEV0jW9P+P/PzfjLxvHu7RT2wfawZ400=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=kO+Jek/ZrJlMP1noHZ9CYJ7exanyX5gwuTuMiWt5bE67pnC3YBBcd8kDWU+ec1fhr
 dyi3PNICiDljB3OGAYrQvxN2YMmWVuaEXb1S4++kvJgc7+cALtsRQ0eOfbpLzfiUZ7
 VIDJaOmU4IMavCSXWHFetRrUtPqdZPgNsyznOJrk=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([212.95.5.238]) by mail.gmx.com (mrgmx002
 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MTTKZ-1hG1cW1hJf-00SMcQ; Thu, 09
 May 2019 10:13:03 +0200
Subject: Re: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>,
 Drew Adams <drew.adams@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default> <877eb0ptiy.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <fcab1f4d-4eb3-0765-d546-aa7fe060549f@HIDDEN>
Date: Thu, 9 May 2019 10:13:06 +0200
MIME-Version: 1.0
In-Reply-To: <877eb0ptiy.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-DE
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:wHIfpgAhk8T10624QlPQ0nhf6/UkMzCOaEtGAUTRDJCuozUEjdk
 6PajqNKieaGekE8aLGEqY4xPD1TwUYXZx1+A6jbwOrztcv3/pxAEsu2h9owcsYY3Xv1F4ZM
 8siWoE3ZATgRv0ib9KhxYzK9fUxYoATY79vVMOmQ1klqrQz+c7u4vHb2Mw9eKJLCvLF04zX
 lVTLO2spnvarw6htRItUg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:vyKLGKePqYI=:wANLkcwLjjRBBLHM7f3Jn8
 nwLwlkclc5wKXs0tyGtIypsnlCeE/S9HsZOhCGu6B2Q9kCflK5tZPQEo4eJeJLnTkFs/eGWDt
 c2CNuUiqe3q2NjvU1rcY8eXr12EQR6Ohw0wY7mBIIqcgJJyWXKMYpiVseBru1jN/4q11Q9Vkz
 FhqWk1rWYG8+4PAyTeHgkJGwYz2VKwMO4LbWnCixAN5tixVu6gL4IB1rzuLFrw3/hngVpSLb2
 BqMzCViM2Mdfm2qmBgxRQf16emYY8mTtzSPZLbvwbFIzfjwmu+WAqYgAglHkNHjQFsudW1yIl
 lROhOPf3XuPN0uG5LBUXixVXI0hepP+ULR3HvZzFn03bdF+biESaTceIgdD+gBPNbpYloItIG
 4etzsdxWM4ALXFqy8cVLE8pYGWoRwjt0IG2lnOSV+VBh+5pCuZTAPCOATwf6r41cR8vMjw5Xt
 SGSfTiFOXPMmdYK1qQ90/IT0MIx+FsoyXzJweJPN2y8iBBczkkzKIqy7edDPukvjsmjVXqlyM
 4favdlvdv9LOr9AVo9YbHiypG9VfRFAJTfXpVgDWzlfrcuvoMZG17rJGBKEjKZ9KHVS8gLzTN
 EXd3+3y5auBFVo18Fs5jVrTR3IPjU747eik+/I3z4IgYHj+Clwcah/XEd/pNTZ+u5/km1ROXW
 WLZKssE9fawoyaLU+Pn/2NaH5qwEk1UlGHe9worn26A0OGZbQZHYRLp1o7o3QmIZUbz3+1oxu
 7RxaOsm4R1byDaRF4+kz4Zb2ZPXlCZKVN6ei6nHpdG9ET5hsh3ROzqnObxc0G3tfE6ZcbNHGd
 L1yvtWxpa+YX2PZ3btbyal+JM2ZL6iWhbneEilN5GRFoisTpC5WhIwlYGJFtoGCEgWh7FxuVV
 lUA38mx6Nilb/5z8CBeAdsXZxdJYDL4AUJpXsmY/DAQURKH5xMsDTn6UyV+fcE8l7MU1Zmdfz
 AWG06iuDgqg==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -1.7 (-)

 > (Perhaps those clients could be migrated to a new face,
 > e.g. 'message-prompt', which would inherit 'minibuffer-prompt' by
 > default?)

Simply 'prompt' would be more intuitive since most messages do not show
prompts.  But I'm afraid we'll have to stick to what we have now.

 > Fair enough.  Should I raise the issue on emacs-devel, or create a new
 > bug report?  Just to make sure I am not omitting something, is this how
 > you would sum up the issue?
 >
 > - In the context of bug#35564, I would like to add text properties to
 >    the y-or-n-p prompt (although I'm open to other, simpler solutions
 >    e.g. simply changing Dired's message).
 >
 > - While this can be patched within y-or-n-p and we can call it a day,
 >    the minibuffer-prompt-face-adding code could be factored out of
 >    'read_minibuf'.
 >
 > - This raises two questions:
 >
 >      1. Do we actually want to use the 'minibuffer-prompt' face in this
 >         context, since the minibuffer is not involved?
 >
 >      2. What do we do with other clients of 'minibuffer-prompt', which
 >         use the same (propertize prompt 'face 'minibuffer-prompt) idiom?

That would sum it up (but since I don't use Dired I can't comment on
that).

Note that this isssue also touches one Drew raised elsewhere - whether
'tooltip-show' should retain face properties of the original text or
show text uniformly with the 'tooltip' face.  Maybe we should
introduce an option like 'prompts-retain-text-properites' so users
have the choice.

 > [1] AFAICT, the commit that added this face (927be33, back when y-or-n-p
 >      was still a C function) does not say why this was thought to be a
 >      good idea.

It's probably part of a concept to have prompts appear uniformly and
integrate them into the framework of themes.  Note that Emacs usually
cannot control the appearance of dialog boxes or system tooltips.

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 8 May 2019 22:40:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 08 18:40:07 2019
Received: from localhost ([127.0.0.1]:34244 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOVEN-0002SB-1V
	for submit <at> debbugs.gnu.org; Wed, 08 May 2019 18:40:07 -0400
Received: from aserp2130.oracle.com ([141.146.126.79]:44018)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hOVEL-0002Rd-Q7
 for 35564 <at> debbugs.gnu.org; Wed, 08 May 2019 18:40:06 -0400
Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1])
 by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x48Mdgd8058753;
 Wed, 8 May 2019 22:40:00 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=M+BonKoczVdH8maEvqLDCQbii9+PdXZzjAfujKHEMdw=;
 b=b5Kjvk7XxIdjXFXlQAadCkkyi6byzaydu533JDUsauTguU8uA+R9eZfMUQpeIC2Mbs4x
 xKjggR1ddIoExz2UyUY5cOtoHcuNk27SJcmvZ2eg1qN2jThzjnPlmhUcBr3dLKBVkQT1
 kDBEKzGrbLr7SuM4MW7JnSgTVfjj+d4jA/hAT6DPa+XZK45ngpkMe4kIlpgxkOMuNQNI
 UOtJul7tN96KgWujiCYYGgXImW4vvuAVHapGxyBCgbej7UTk45D2iCUWbbpxn1aMllfv
 H6Eqc4pBQGc6zxPqC/oUzmEIV05gtVTPUgkGxSkQOgukLOEwLU+Mk8+UGQJkS0X6KbmR 3w== 
Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80])
 by aserp2130.oracle.com with ESMTP id 2s94b67av8-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 08 May 2019 22:39:59 +0000
Received: from pps.filterd (userp3030.oracle.com [127.0.0.1])
 by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x48Mdw3a092858;
 Wed, 8 May 2019 22:39:59 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by userp3030.oracle.com with ESMTP id 2sagyuw67d-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 08 May 2019 22:39:59 +0000
Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x48MdvwI029603;
 Wed, 8 May 2019 22:39:57 GMT
MIME-Version: 1.0
Message-ID: <f0e01326-5884-496e-957f-b6cce7343b6d@default>
Date: Wed, 8 May 2019 15:39:56 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: =?utf-8?B?S8OpdmluIExlIEdvdWd1ZWM=?= <kevin.legouguec@HIDDEN>, martin
 rudalics <rudalics@HIDDEN>
Subject: RE: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default> <877eb0ptiy.fsf@HIDDEN>
In-Reply-To: <877eb0ptiy.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4834.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1905080134
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9251
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1905080135
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -3.3 (---)

> Drew Adams <drew.adams@HIDDEN> writes:
>=20
> > I don't see any good reason why face `minibuffer-prompt'
> > should be used, especially by default (users can do
> > whatever they like) for situations where there is no
> > active minibuffer, i.e., for prompting situations
> > generally.  It should instead serve as a useful clue
> > that the minibuffer is being used.  (Just one opinion.)
>=20
> I'd hazard a guess[1] that this was done to make y-or-n-p and
> yes-or-no-p similar from a UI point of view: they both prompt the user
> for a binary answer, therefore the prompt might as well look the same in
> both situations.
>=20
> From what I can tell the use of 'minibuffer-prompt' in minibuffer-less
> situations has enough precedents (the "other clients" Martin mentions)
> that the "minibuffer-" prefix might be considered a historical accident
> by now=E2=80=A6

Not an accident.  The "precedents" are themselves bugs,
IMO.  The minibuffer is the minibuffer.  It's important
that users be aware when it is active.  That may not
matter much for `yes-or-no-p', as it insists on "yes"
or "no".  But it is important for the minibuffer in
general.  The minibuffer is an editing buffer; you can
do lots of things in it and with it.

> (Perhaps those clients could be migrated to a new face,
> e.g. 'message-prompt', which would inherit 'minibuffer-prompt' by
> default?)

That would be fine by me.  Or no face.  Is it really
important that the prompt be distinguished by a face?

(To be clear, I have no objection to our using faces
for prompts.)

> - In the context of bug#35564, I would like to add text properties to
>   the y-or-n-p prompt (although I'm open to other, simpler solutions
>   e.g. simply changing Dired's message).

I wouldn't mention bug #35564.  And that bug should not,
itself, also deal with prompt faces.  It should be only
about `dired-do-shell-command' warning about wildcard
characters.

Any question (for this command or in general) about
prompt faces is independent of this bug report about
the `dired-do-shell-command' treatment of wildcards.

(Just one opinion.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 8 May 2019 20:42:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 08 16:42:56 2019
Received: from localhost ([127.0.0.1]:34162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hOTOx-0005vL-OS
	for submit <at> debbugs.gnu.org; Wed, 08 May 2019 16:42:56 -0400
Received: from mail-wm1-f67.google.com ([209.85.128.67]:35647)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hOTOw-0005v2-3d
 for 35564 <at> debbugs.gnu.org; Wed, 08 May 2019 16:42:54 -0400
Received: by mail-wm1-f67.google.com with SMTP id y197so296313wmd.0
 for <35564 <at> debbugs.gnu.org>; Wed, 08 May 2019 13:42:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=9ijUDtjRfu2Yz9a0aK2g3lpaL/qyd6gwMqzMGGOE0L4=;
 b=qevMt2yx8Pj+MZbp6Zh5d173LXkC0j2PoK1pFTgD/PsJptoELmAPjWL4CQVPoLHPin
 DUHMnmQ36JAuym9n4I9WXtvpqaX3cV/ztDQLA3rFNUb2R6xWhqA/XMPkZNymU0d4lOUt
 0n87ek75Xl6gSzNRF3AFCGIyxcN85NY/KNbyqF1YloRnq+FkuwSGUhwlmVRWHwmVMAXR
 MsOSEEdDmNeG2p0ZBvPUr5ZtYbQR7YaM5wdHPDxdIIdUqQfMdNVVViqNEoHT5gZRJPG1
 oMXdVY5X6sgatuN9AWeCxl1GtIPhGFYD4sV+gdn0jEnchwGMp4X1I993bb0P4JrC03bm
 d+wQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=9ijUDtjRfu2Yz9a0aK2g3lpaL/qyd6gwMqzMGGOE0L4=;
 b=ndGjCPO041Zq/FwpjPkEqA7RO2CsS5XJJXUtSAFtAagksYgDujusW7gU1YsNyUNvlj
 b0DN6DTfdAlpAMTeHQHROT+9r+br/eFljKoRGah+1sru3DJTBSA2wYJrMLzcST5Od3vQ
 2ne2bwsQksqz/l7+C5rwZvOeMa5C9PW9ScX049OvHkFIpe7o5kCylMVe9bnzhz9xVqK8
 fu7yLKgGWLolpNBRLGbDEgUTcC4OfrLk3vmHkrzm+aT386MGLn6NhNwF75IEhszmV/jS
 zlLOyx60nlcTAA8uJ7diO6isVeOKq92q3w2BiQZkdOYVMLVUu1ddmQW3qUefHgINFvM5
 WHfQ==
X-Gm-Message-State: APjAAAXjSwWCwE8ZVmCIdUIsEkiw1bMQKjmZr0gauRc527QfAI09eem3
 fFAM24enEitEImquLRWqkE9qVdhT
X-Google-Smtp-Source: APXvYqyue9f+FSjCqB+0NE75t2G97CraoY00smwApaOCk9MIa0F3gYec1uCQ/fmMu7SAB6+/DKkTxA==
X-Received: by 2002:a7b:ce06:: with SMTP id m6mr146613wmc.62.1557348167981;
 Wed, 08 May 2019 13:42:47 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id s3sm35692567wre.97.2019.05.08.13.42.46
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 08 May 2019 13:42:46 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>, martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#35564: 27.0.50;
 [PATCH] Tweak dired-do-shell-command warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN>
 <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
 <9fc1129c-5377-4b56-ba6d-dce497140941@default>
Date: Wed, 08 May 2019 22:42:45 +0200
In-Reply-To: <9fc1129c-5377-4b56-ba6d-dce497140941@default> (Drew Adams's
 message of "Tue, 7 May 2019 06:19:10 -0700 (PDT)")
Message-ID: <877eb0ptiy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -1.0 (-)

Drew Adams <drew.adams@HIDDEN> writes:

> I don't see any good reason why face `minibuffer-prompt'
> should be used, especially by default (users can do
> whatever they like) for situations where there is no
> active minibuffer, i.e., for prompting situations
> generally.  It should instead serve as a useful clue
> that the minibuffer is being used.  (Just one opinion.)

I'd hazard a guess[1] that this was done to make y-or-n-p and
yes-or-no-p similar from a UI point of view: they both prompt the user
for a binary answer, therefore the prompt might as well look the same in
both situations.

From what I can tell the use of 'minibuffer-prompt' in minibuffer-less
situations has enough precedents (the "other clients" Martin mentions)
that the "minibuffer-" prefix might be considered a historical accident
by now=E2=80=A6

(Perhaps those clients could be migrated to a new face,
e.g. 'message-prompt', which would inherit 'minibuffer-prompt' by
default?)


martin rudalics <rudalics@HIDDEN> writes:

> So although I'd vote for a solution like the one you propose in your
> patch, any decision in this area is subtle and should be approved by
> others first.  Also because we'd then have to decide what to do with
> other clients of the 'minibuffer-prompt' face like 'read-char-choice'
> or the ones in isearch.el.

Fair enough.  Should I raise the issue on emacs-devel, or create a new
bug report?  Just to make sure I am not omitting something, is this how
you would sum up the issue?

- In the context of bug#35564, I would like to add text properties to
  the y-or-n-p prompt (although I'm open to other, simpler solutions
  e.g. simply changing Dired's message).

- While this can be patched within y-or-n-p and we can call it a day,
  the minibuffer-prompt-face-adding code could be factored out of
  'read_minibuf'.

- This raises two questions:

    1. Do we actually want to use the 'minibuffer-prompt' face in this
       context, since the minibuffer is not involved?
=20=20=20=20=20=20=20
    2. What do we do with other clients of 'minibuffer-prompt', which
       use the same (propertize prompt 'face 'minibuffer-prompt) idiom?


Thank you both for your thoughts on this.


[1] AFAICT, the commit that added this face (927be33, back when y-or-n-p
    was still a C function) does not say why this was thought to be a
    good idea.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 7 May 2019 13:19:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 07 09:19:23 2019
Received: from localhost ([127.0.0.1]:58379 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hO00B-0007Le-Ae
	for submit <at> debbugs.gnu.org; Tue, 07 May 2019 09:19:23 -0400
Received: from userp2120.oracle.com ([156.151.31.85]:47498)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hO009-0007LM-A9
 for 35564 <at> debbugs.gnu.org; Tue, 07 May 2019 09:19:22 -0400
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47DIaEC179278;
 Tue, 7 May 2019 13:19:14 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=Gro0WsLvTKu4OJw7A8+qDJcX4tgNx4/ejIL0J6LaBHg=;
 b=upUA/neVvz7M9Gg2OYHfjI38XCnUM0T0A7VUMADbw9N8RyN6wYVUACbOZyKdbOSyjbo/
 nmMEAnt5LRmYTgr6rdS0D0uCh2Iz9Z//BI5D0caN1nPzi094c2FYUVHjdqtliZ7E5lts
 3HE0ZCitImuDdi6CyC0qmZxF25J0EUGVrGG4ht51CENERHPbLPfMHGtqiY1FBGgc/IlE
 dts37SosQZdCAQbw7N4uS/2HGgucARoizdxu7dXx/Pp7LeNiRNYP9qCUYW1+nN/euPb+
 FBk5wEN/IWaoDZbKPHU9FpGfZeIVxL2To05qBTeWAZHtjRhhr18AO08P3FrdiCLyQ7pl UQ== 
Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71])
 by userp2120.oracle.com with ESMTP id 2s94b0n6eu-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Tue, 07 May 2019 13:19:13 +0000
Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1])
 by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x47DIxVx137943;
 Tue, 7 May 2019 13:19:13 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by aserp3030.oracle.com with ESMTP id 2s94b9fe0v-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Tue, 07 May 2019 13:19:13 +0000
Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x47DJBvl031148;
 Tue, 7 May 2019 13:19:11 GMT
MIME-Version: 1.0
Message-ID: <9fc1129c-5377-4b56-ba6d-dce497140941@default>
Date: Tue, 7 May 2019 06:19:10 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>, =?utf-8?B?S8OpdmluIExlIEdvdWd1ZWM=?=
 <kevin.legouguec@HIDDEN>
Subject: RE: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
 <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
In-Reply-To: <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4834.0 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9249
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1905070087
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9249
 signatures=668686
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1905070087
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -3.3 (---)

> By design, 'yes-or-no-p' and 'y-or-n-p' are kept apart to avoid that
> people use the latter for more "crucial decisions".  Part of this
> distinction is that 'y-or-n-p' is asked in the echo area, so applying
> 'minibuffer-prompt-properties' would be conceptually inappropriate.
> Obviously, applying 'minibuffer-prompt' is just as inappropriate (that
> face is part of 'minibuffer-prompt-properties') but that's a decision
> that has been made long ago.
>=20
> So although I'd vote for a solution like the one you propose in your
> patch, any decision in this area is subtle and should be approved by
> others first.  Also because we'd then have to decide what to do with
> other clients of the 'minibuffer-prompt' face like 'read-char-choice'
> or the ones in isearch.el.

I don't see any good reason why face `minibuffer-prompt'
should be used, especially by default (users can do
whatever they like) for situations where there is no
active minibuffer, i.e., for prompting situations
generally.  It should instead serve as a useful clue
that the minibuffer is being used.  (Just one opinion.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 7 May 2019 08:15:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 07 04:15:48 2019
Received: from localhost ([127.0.0.1]:58163 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hNvGN-0001RQ-TB
	for submit <at> debbugs.gnu.org; Tue, 07 May 2019 04:15:48 -0400
Received: from mout.gmx.net ([212.227.17.21]:59211)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1hNvGM-0001RC-AK
 for 35564 <at> debbugs.gnu.org; Tue, 07 May 2019 04:15:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1557216940;
 bh=M+Ew0w+/jLPccHQv9GmiVTcO2wRWmoPZZ0BdchD2rho=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=ThW6D5AZDehdNlPxv7XQ+9CzOF2J/QZUln2Yh5sDuL8xDHApPV4nmHERyAEmn40pn
 OiZ4FqS+Fg5lc9DivDvQnECjAKY9hozX1qRZUJJUilUeZZ+H2nFfB7BKUgMXc3DHcS
 PVrDKXxbWA6y3pGw9T79sHXPiTjetHM70lQV3Aug=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([212.95.5.94]) by mail.gmx.com (mrgmx101
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MJGFi-1hQf573g66-002lN9; Tue, 07
 May 2019 10:15:39 +0200
Subject: Re: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> <877eb3e5im.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <9bd289fe-3623-4c45-4c4f-04c6668cae76@HIDDEN>
Date: Tue, 7 May 2019 10:15:42 +0200
MIME-Version: 1.0
In-Reply-To: <877eb3e5im.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-DE
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:UunCkSMnvbAPI9igSPMOeA3O7xsJ58px7hjZYtkBTjQX+ISnDLL
 jwF6UQz2s74rCg0bkqtAsvmbYfPYiOCRR7D1Ve/jFppJS+s5uXJy65CQTLAEuYXSFt77XkU
 X/6/SO2tPpC2O4FclSYkyAUmEsBHAQPZmMsUWOOeWJGISH2AVoi7tcXUu3caWkqZ7Uq+edp
 1P/KpSwvcKI3PTJdnm8mw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:LkDQuh2HP9I=:nUO4oWXRzPjLE13rt8qkSd
 0qK9wCix9WmvjoHrvfDG2/dH/BHu6WtygJlJkPLmjNTAtPRjhAzMMGdMZSgN+5NIjOZnGhIDG
 Rm24dV1RVJW2Tt5ancdHuZqYMttDHxE4kjqx8ADF/bkwTVJ3BFnMFaeS7E4YpcRwYc9N6PS6C
 S0+HesCumn8n3A7qgoy1VaC3xiEfcsc91fQHsBY/gDLlrBAusoJsYq5yCceDk3OsMfhIh7I04
 M3w8O5RxFDAQpf5eDy8JwhJ1xnswH5YWNFAw1rLX5jsyOYoOl2ExHEpARsJ4uDPKrEmJuWT24
 PGHPYS3wF5OSlOWMlFKdlC5GWi/O3nZOuKoPjwJktrWnMkJurdXW8nCoQae9Sx6xHy9TreWZZ
 M6AHJAsBnEQqDxoC7Jnw57o95PDl4tZSgk2OdOUBX3APSz2nQpi6qDMwYDFQqcWOZD7vA0SJk
 BJpn09wdj0V5ogq11GzfiRf7VdDpt5UF+Fif8A4e0HWt4Lk3GeRHIXBALHIEh2st58nt2wmhj
 CYMCmwz0Dzj8cFts5+so8cK2NKRDcontSHyfyRzQCJA+VrsdKMza9PxKNCNKe9koH9JGvp/eJ
 hJGEWDgdDqgaJziL7zYwJtaW7evUmQrb21rUJQJech1VMVPj3nImgPR1p4A71WPh1VORlBEr6
 lCTDRfR+jA4+IH7PixyvCWIIbW84P5QdDKIyeeapiMT+3nbr3CIZvn3cBrJ5wCcMEvNaj9ZGf
 7t4xz8h37INoVFdlti6opP3c0SH3qiP44YZR2x8dwNja7VvByznqGZ6/Chj9Dkh85h0J3i9lO
 2Fh8+mLbk9P0LlQbssUZ9HC93irskvx0LNNjI9vEtrVVd+8fBg2dcyeLkeZ43bXYjQmbJ12XO
 672oM1qr4rHrOatUMSm3nypyGV8PUO6tKuKZiwUUW5MFrbeJyVR7oHamuv/EF006vn3GPIAkQ
 h5eElFFF4hQ==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -1.7 (-)

 > I dug into yes-or-no-p until I came across `read_minibuf()'; is this the
 > code you are referring to?

It is.

 > If one were to fix the issue of y-or-n-p hardcoding the face property,
 > what would be the best way to go?
 >
 > 1. Make a C DEFUN out of this snippet, and have it called by
 >     `read_minibuf()' and `y-or-n-p'.
 >
 > 2. Re-implement this snippet as an Elisp defun, and have it called by
 >     `read_minibuf()' and `y-or-n-p'.
 >
 > 3. (Re-implement this snippet within `y-or-n-p'.)
 >
 > (FWIW, the attached patch seems to work as a workaround, but I assume
 > solutions 1 or 2 would be better, by virtue of reusing code)

By design, 'yes-or-no-p' and 'y-or-n-p' are kept apart to avoid that
people use the latter for more "crucial decisions".  Part of this
distinction is that 'y-or-n-p' is asked in the echo area, so applying
'minibuffer-prompt-properties' would be conceptually inappropriate.
Obviously, applying 'minibuffer-prompt' is just as inappropriate (that
face is part of 'minibuffer-prompt-properties') but that's a decision
that has been made long ago.

So although I'd vote for a solution like the one you propose in your
patch, any decision in this area is subtle and should be approved by
others first.  Also because we'd then have to decide what to do with
other clients of the 'minibuffer-prompt' face like 'read-char-choice'
or the ones in isearch.el.

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 6 May 2019 19:40:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 06 15:40:16 2019
Received: from localhost ([127.0.0.1]:57484 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hNjTE-0008Gd-J9
	for submit <at> debbugs.gnu.org; Mon, 06 May 2019 15:40:16 -0400
Received: from mail-wr1-f46.google.com ([209.85.221.46]:38624)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hNjT9-0008GG-NZ
 for 35564 <at> debbugs.gnu.org; Mon, 06 May 2019 15:40:15 -0400
Received: by mail-wr1-f46.google.com with SMTP id k16so18840895wrn.5
 for <35564 <at> debbugs.gnu.org>; Mon, 06 May 2019 12:40:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=JjOl4uON+6IYz53ZfrG8kSWPhtNv1ly3WR89yli62UA=;
 b=UgVUG46sJQRnVIRSUhQQ8YNqmg8zLf7zj9u3rfFfcAIE9N4P3skrro2ya6wW6kvgVQ
 SiLFVJzMF4bZnmLRx3wMyl/3mWFeC2POnchsgPQynYxBCojhXyFwlQxwkBRwfklEC6O3
 wt/7tnsDUH0uoA8FDCKaJ5yfJW+Clii+EV7q4o1ayFWz2FqSJGg0EN4TncrYggngVmek
 K68tyTzzUComYSsiVcagzSkUJbqFOa85S9QhGpbS3GQuC/tb9MIpTQHNOZgJ/DYEVRUQ
 9H3BW2eJ1JQyVmh5gaNKh4DnANLrbMWbHDqG+VwwO1INy1cd6wO5LlIL12HnD4BT6K9u
 K20Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=JjOl4uON+6IYz53ZfrG8kSWPhtNv1ly3WR89yli62UA=;
 b=PpRzPeMQc0eDmlsg4JmF0UXlsbyTs79RvYtjSwPVN3+wCk8QrgHDUf/ECr/WqJ85ul
 0NO46INk1mtC+6Auj87r6arxLCBqQMM+s6N7MBDj+d5l/nDcxGIep8l4+WhlG8PKB3eK
 ObigTGpuLyMy/SF+Lu129R2Dhpcqfd1Jul3oRVv+ENXnj7RIQym3x81GBYGILP2ECWk+
 83UoxPytkNu9sAaUoN8z61Y8BheOdhEuxY3vG6V4r97UDpqzOI4+z6uZHjQ0MxuEupgM
 uvjegzB+Vb/yZCh/KeUo+GA9IrSdQgewmxekATJ+hhMCSLgySBcKpa2A1hetAnYK0i4+
 2Yow==
X-Gm-Message-State: APjAAAVPdYiBkOuR23IKaomycqmxoM2FW2sEfG9rorz0T56s6p63zbIT
 cRwKXn/jsxMlsGksl1CPj0RYgquh
X-Google-Smtp-Source: APXvYqw8SWW+0LzWEdnMsJm2gLf++bHOe/n4NkYQ2ZEAbblqML/+zT2FpwvZXsfUGUyqhe8IMuiuxg==
X-Received: by 2002:adf:8bc5:: with SMTP id w5mr18933872wra.226.1557171605434; 
 Mon, 06 May 2019 12:40:05 -0700 (PDT)
Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net.
 [109.13.142.71])
 by smtp.gmail.com with ESMTPSA id q7sm12054896wmc.11.2019.05.06.12.40.03
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 06 May 2019 12:40:04 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#35564: 27.0.50;
 [PATCH] Tweak dired-do-shell-command warning about "wildcard"
 characters
References: <87zho2cd4f.fsf@HIDDEN>
 <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN>
Date: Mon, 06 May 2019 21:40:01 +0200
In-Reply-To: <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN> (martin rudalics's
 message of "Sun, 5 May 2019 10:44:21 +0200")
Message-ID: <877eb3e5im.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 35564
Cc: 35564 <at> debbugs.gnu.org
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: -1.0 (-)

--=-=-=
Content-Type: text/plain

martin rudalics <rudalics@HIDDEN> writes:
>> [1] Compare:
>>
>> (let ((prompt "foobar "))
>>    (add-face-text-property 3 6 'warning nil prompt)
>>    (yes-or-no-p prompt))
>>
>> With:
>>
>> (let ((prompt "foobar "))
>>    (add-face-text-property 3 6 'warning nil prompt)
>>    (y-or-n-p prompt))
>
> 'y-or-n-p' propertizes the prompt rigidly as
>
>                     (read-key (propertize (if (memq answer scroll-actions)
>                                               prompt
>                                             (concat "Please answer y or n.  "
>                                                     prompt))
>                                           'face 'minibuffer-prompt)))))
>
> while 'yes-or-no-p' carefully applies 'minibuffer-prompt-properties'
> to any text properties provided with PROMPT.

Well, that's interesting.

I dug into yes-or-no-p until I came across `read_minibuf()'; is this the
code you are referring to?

    if (PT > BEG)
      {
        Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qfront_sticky, Qt, Qnil);
        Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qrear_nonsticky, Qt, Qnil);
        Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                            Qfield, Qt, Qnil);
        if (CONSP (Vminibuffer_prompt_properties))
          {
            /* We want to apply all properties from
               `minibuffer-prompt-properties' to the region normally,
               but if the `face' property is present, add that
               property to the end of the face properties to avoid
               overwriting faces. */
            Lisp_Object list = Vminibuffer_prompt_properties;
            while (CONSP (list))
              {
                Lisp_Object key = XCAR (list);
                list = XCDR (list);
                if (CONSP (list))
                  {
                    Lisp_Object val = XCAR (list);
                    list = XCDR (list);
                    if (EQ (key, Qface))
                      Fadd_face_text_property (make_fixnum (BEG),
                                               make_fixnum (PT), val, Qt, Qnil);
                    else
                      Fput_text_property (make_fixnum (BEG), make_fixnum (PT),
                                          key, val, Qnil);
                  }
              }
          }
      }

If one were to fix the issue of y-or-n-p hardcoding the face property,
what would be the best way to go?

1. Make a C DEFUN out of this snippet, and have it called by
   `read_minibuf()' and `y-or-n-p'.

2. Re-implement this snippet as an Elisp defun, and have it called by
   `read_minibuf()' and `y-or-n-p'.

3. (Re-implement this snippet within `y-or-n-p'.)

(FWIW, the attached patch seems to work as a workaround, but I assume
solutions 1 or 2 would be better, by virtue of reusing code)


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Make-y-or-no-p-keep-the-supplied-prompt-s-face.patch

From 9ea712779d725a23fe8f4acd7b934b0a64a1f1ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Mon, 6 May 2019 21:26:37 +0200
Subject: [PATCH] Make y-or-no-p keep the supplied prompt's face

* lisp/subr.el (y-or-n-p): append the minibuffer-prompt face instead
of overwriting the prompt's face property.
---
 lisp/subr.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index f68f9dd419..8d224ff5bb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2647,11 +2647,15 @@ y-or-n-p
                   (let ((cursor-in-echo-area t))
                     (when minibuffer-auto-raise
                       (raise-frame (window-frame (minibuffer-window))))
-                    (read-key (propertize (if (memq answer scroll-actions)
-                                              prompt
-                                            (concat "Please answer y or n.  "
-                                                    prompt))
-                                          'face 'minibuffer-prompt)))))
+                    (read-key
+                     (let ((prompt-maybe-please
+                            (if (memq answer scroll-actions)
+                                prompt
+                              (concat "Please answer y or n.  " prompt))))
+                       (add-face-text-property
+                        0 (1- (length prompt-maybe-please))
+                        'minibuffer-prompt t prompt-maybe-please)
+                       prompt-maybe-please)))))
             (setq answer (lookup-key query-replace-map (vector key) t))
             (cond
 	     ((memq answer '(skip act)) nil)
-- 
2.21.0


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable



Thanks for your help!

K=C3=A9vin

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at 35564) by debbugs.gnu.org; 5 May 2019 08:44:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 05 04:44:31 2019
Received: from localhost ([127.0.0.1]:52951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hNCl5-0001Ib-60
	for submit <at> debbugs.gnu.org; Sun, 05 May 2019 04:44:31 -0400
Received: from mout.gmx.net ([212.227.15.19]:51381)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1hNCl3-0001IK-1U
 for 35564 <at> debbugs.gnu.org; Sun, 05 May 2019 04:44:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1557045862;
 bh=awhAWkpTDaS3H8cOEFzh8mEyPgTy6TPgLXoYsF6IpVk=;
 h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To;
 b=UegZYBSkFEZTnKpUPr7r2L75ksRIne7w94xJdjf+RpnoDrvNIQvlWK4ubgRBGcOka
 37D6Qsfx9zXCx+x77RJgrD8TzpVqdqY0QZQ1G9IEwRepcFiUPrwpqfgE7BvgW8ODDP
 iwsTk7ZW6davhgFzBBNTxP1QyuFI6gdeHifE8xHk=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.101] ([212.95.5.233]) by mail.gmx.com (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MgvrL-1gpHBb1CtZ-00hLMP; Sun, 05
 May 2019 10:44:22 +0200
Subject: Re: bug#35564: 27.0.50; [PATCH] Tweak dired-do-shell-command warning
 about "wildcard" characters
To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>,
 35564 <at> debbugs.gnu.org
References: <87zho2cd4f.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <071cc96c-1bf2-f331-8f9e-b3c54a7452da@HIDDEN>
Date: Sun, 5 May 2019 10:44:21 +0200
MIME-Version: 1.0
In-Reply-To: <87zho2cd4f.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-DE
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:l+EaNutZpsMrLi9tb4x+5v7Gx2+U97zcuLfAl3y7kcQaK9L1gE5
 U644z4Az8fRveHjU5fbklEPAEYsGuoCAQFPDKG70ECarOZSOvyK2rnYSvf7rpelJeBdbNV9
 3nk+OsVdXr18ibzVXxVbvTmO66tQWt3p604GMnqvlpDfldzqxc2CVWEC+ZBeBLvA8hEXiev
 oNwfKyJFui93DnqmFSr4A==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:sUfYCCbdBzM=:dvNuSr5kjZcWCGF0bENKnw
 nGiP8g8jxK3PIIIdhwiio2OEAZ8K7vVLKt9IIXYHyjqIH2OaUQbSClXukPkR4e50ErklCUYMr
 1Iy8rCIeX+EpMKk5wWbFzj+VQnl+Wl7eW2h7kbBON/32N9r7P8rXdf8yRyAJfpkjbb/wz7RAr
 OeAMvODmAViSJEqmOY8CKXzNa4XFCmaDoLk9hDubI71eR9fIdXEgiQfnpP7xEgNZfqbZWTZsZ
 rYXHTTZZQXLrULLCxj7QxkzGgdzwGGJA/PE3WUHKeDyyOuYZ9zmdv6ogu1PyzotNaEp0iaehL
 L4oi8lGqYm0UHjugQvVbcigThImCNB4+IVlJ92JOKLPligiqIfFWeXFPp7XzHWFCXXklAlfDG
 ps8zHANrG8TV6T6/dJpSWKBh0hji50cAyzd4Qubgv85+x+p0L6zwq/rpIb4MAPmpbv2nMkSA1
 jbD0Bvj2gopFo+ooyNgkwLG2u9C60x/048opSqmPEPWdhZKGNhbpfpV1xyQVV1hb2XN5nOPiY
 1s9YpsGaQ8DftIhpQGnh4H6pmUbdgPtfyKk/uE6lomwOQaQaNvVXu5I4BSBkOuMY2/vUdFYib
 2MKFh0leZMxJp/+fKiZFnwlxXyk61FLnf0pju7EEftsOzzQE6JF6HUl4W3zsxESOFm61NAN3+
 CcYeVUQkbShFdy6RJ21ymGfIvTaPtLvLkzIkkl0XqPjJsyg6v39HIMhQ4lZgiYFTOFedQtUtv
 2gLMpZGlDm2E9xvT6GOOx3yFYnGAJuAiB8Jamk69C+fh2Knm0AYDm0/lf1mg3xe9RmEKwATgw
 y0uhnh8sYUaIMJd4KHrmfOqLEAb7UlxylEzXiBZ7u4i5zG+nbDV1NcAu+UFRIJhV1bphgmvUo
 aPgwspWvjslQdnpCH+cJ7T9IT8FypSE5/jWPCkP5t1UQF+7m0StGVRsbncEQk7kFZXlApNhzg
 xvwdQy+qNFg==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 35564
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: -1.7 (-)

 > =E2=80=A6 and ended up with the attached patch, which I am not entirel=
y
 > satisfied with (for one, it replaces `y-or-n-p' with `yes-or-no-p'
 > merely because the former seems to strip my prompt's text attributes
 > somehow[1]).

[...]

 > [1] Compare:
 >
 > (let ((prompt "foobar "))
 >    (add-face-text-property 3 6 'warning nil prompt)
 >    (yes-or-no-p prompt))
 >
 > With:
 >
 > (let ((prompt "foobar "))
 >    (add-face-text-property 3 6 'warning nil prompt)
 >    (y-or-n-p prompt))

'y-or-n-p' propertizes the prompt rigidly as

                     (read-key (propertize (if (memq answer scroll-action=
s)
                                               prompt
                                             (concat "Please answer y or =
n.  "
                                                     prompt))
                                           'face 'minibuffer-prompt)))))

while 'yes-or-no-p' carefully applies 'minibuffer-prompt-properties'
to any text properties provided with PROMPT.

martin





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35564; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 4 May 2019 18:02:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 04 14:02:22 2019
Received: from localhost ([127.0.0.1]:52208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hMyzN-0006Oz-FR
	for submit <at> debbugs.gnu.org; Sat, 04 May 2019 14:02:22 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54408)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hMyzK-0006Of-Pm
 for submit <at> debbugs.gnu.org; Sat, 04 May 2019 14:02:19 -0400
Received: from lists.gnu.org ([209.51.188.17]:46550)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <kevin.legouguec@HIDDEN>)
 id 1hMyzD-00013L-Cd
 for submit <at> debbugs.gnu.org; Sat, 04 May 2019 14:02:11 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40500)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hMyzB-0003nP-6E
 for bug-gnu-emacs@HIDDEN; Sat, 04 May 2019 14:02:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <kevin.legouguec@HIDDEN>) id 1hMyz6-0000tQ-UY
 for bug-gnu-emacs@HIDDEN; Sat, 04 May 2019 14:02:07 -0400
Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:41990)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <kevin.legouguec@HIDDEN>)
 id 1hMyz5-0000oS-OV
 for bug-gnu-emacs@HIDDEN; Sat, 04 May 2019 14:02:04 -0400
Received: by mail-wr1-x436.google.com with SMTP id l2so11839673wrb.9
 for <bug-gnu-emacs@HIDDEN>; Sat, 04 May 2019 11:01:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=+lqChYEfJfKf9vZ3WLmGqlr9sjEQHRWBVg+ut8sxvRc=;
 b=p6N7A2+73QecVYIDJmmc0oY/UHKZK4UYPuuDjPUA7oa3agFie8S1KbcKaSCGZqs1uN
 skEc/eLzBojJ3jHmHPVJ1q92cg1b21EdI2vO1KxGCVGh1FzM6Qr6AcrHSO6yvHSz1+ax
 olzuRf/k/dMF7LaaZzdQ90OnjnkeFPgRCQJi7NwUJE8He705zYM4M5+1SLvrMjaIXKuE
 rG4CuQaN7vaXbCddAaa3OMoBK8Kkc1XKlWOwinStFJvrA8QttBuMdtIen/uvhCjdbbhW
 zhkxx1EqlI1S+8WyH4XIy1Eiuqt/zWjmk0O8S+oIUoJy3o27lIqJjYta2Yd0+6wlZjxR
 FAxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=+lqChYEfJfKf9vZ3WLmGqlr9sjEQHRWBVg+ut8sxvRc=;
 b=XWuMG2xNDpTyQCZhWrPW5PsJgPnqEEORa9TiiVR2nABIb1yEoYIyY8e2R041RZkg1n
 clcOZMg2SoKm5JOVW353PjyUKziSwxRPMYozrONV8FsgVT5J6eQ8bY2dc3kUjv+1mP2Q
 vEtcLlwViRPD3fos0D4trej0YA5m8uQgu0vc3ydibyCiv4UND5vUrYtSm3fC3qyRTY2H
 MSDe6+M2015WXW+Hnmv4W2ystUi+Zz+dKrOgyCY52g0LQeB4MJ70Int/w4QKsmSVsGYg
 jHGOqGaYGgpy/k5BxWDrtUfK9aQp3oEWfE7UBVVoBRHyFw0BobUTjaSdklUOvWxqObxG
 64yw==
X-Gm-Message-State: APjAAAUZYih1u9S7IkBx4mq7jcrqrwEnQ+ETIELcPMIDbx5YHNXv0FRZ
 5YW04NXmlwn3N0L4VYgVEGuiSg1F
X-Google-Smtp-Source: APXvYqzGfJUSKBoxQtB3SOV8WhLrJY6Mpx4fFeSkKnKZgC+Vw8jmqjYHh8ZOFEtXG5O3gCUgItHVCw==
X-Received: by 2002:a5d:6b04:: with SMTP id v4mr10011591wrw.69.1556992914793; 
 Sat, 04 May 2019 11:01:54 -0700 (PDT)
Received: from nc10-laptop
 (2a01cb04010fc800c8771fb97d0446e3.ipv6.abo.wanadoo.fr.
 [2a01:cb04:10f:c800:c877:1fb9:7d04:46e3])
 by smtp.gmail.com with ESMTPSA id z5sm10346175wre.70.2019.05.04.11.01.53
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 04 May 2019 11:01:53 -0700 (PDT)
From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= <kevin.legouguec@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; [PATCH] Tweak dired-do-shell-command warning about "wildcard"
 characters
Date: Sat, 04 May 2019 20:01:52 +0200
Message-ID: <87zho2cd4f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::436
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -1.3 (-)
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.3 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello,

The function dired-do-shell-command checks the user's command for any
star or question mark not surrounded by whitespace or backquotes,
asking whether they are deliberate, since the character will then be
sent as-is to the shell, instead of being replaced with the marked
file(s).

A silly example:

- Open a Dired buffer
- M-! echo "Foobar." > foo RET
- g
- with point on foo:
    - ! sed 's/\./?/' RET

The way the question is phrased bothers me:

> Confirm--do you mean to use `?' as a wildcard?

The first time I met this prompt was when I included a quoted '?' in
my command as in the example above, so I definitely did *not* mean to
use '?' as a shell wildcard.

Even now, knowing what the question really means, it still trips my
brain that I must answer "yes" (as in, "yes, I know Dired will not
substitute the marked files") when I mean "no" (as in, "no, I don't
mean to use '?' as a wildcard, what is this even ab- oh wait no right
I meant yes! Yes! =F0=9F=A4=A6").

I can think of a few ways to solve this:

1. Rephrase the question to be more general, specifically without
   calling the characters "wildcards"; for example:

> Confirm--do you mean to send `?' to the shell without substitution?

2. Parse the command to find out whether the shell will actually use
   these characters as wildcards.
    - not sure how portable this would be across different shells
    - AFAICT the aim of this prompt is simply to warn the user that
      Dired will not expand these characters; whether the shell will
      process them as wildcards is irrelevant

3. Add an option to skip this question (more of a workaround than a
   solution).

Favoring option #1, I tried to find alternative questions, but none of
the ones I came up with sounded satisfying (most of them included some
form of double-negation, which is not the kind of puzzle I want to
solve when I'm about to run a hastily-put-together Bash oneliner).

I played around with the idea of actually *showing* the
"unsubstituted" characters to the user in order to be able to say
something like=E2=80=A6

> Confirm--the highlighted characters will not be substituted.
> Proceed?

=E2=80=A6 and ended up with the attached patch, which I am not entirely
satisfied with (for one, it replaces `y-or-n-p' with `yes-or-no-p'
merely because the former seems to strip my prompt's text attributes
somehow[1]).


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Make-dired-do-shell-command-highlight-unsubstituted-.patch

From f1d6df845909fd8a6fb0500984fd305d6cf6d6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@HIDDEN>
Date: Sat, 4 May 2019 18:45:43 +0200
Subject: [PATCH] Make dired-do-shell-command highlight unsubstituted
 characters

Stop calling them "wildcards", since they may be quoted,
backslash-escaped, etc.

NB: y-or-n-p has been changed to yes-or-no-p since the former makes
the highlighting disappear, for some reason.

* lisp/dired-aux.el (dired--isolated-char-p):
(dired--highlight-nosubst-char):
New functions.
(dired-do-shell-command):
Use them.
* test/lisp/dired-aux-tests.el: Test new functions.
---
 lisp/dired-aux.el            | 49 +++++++++++++++++++++++++++++++++---
 test/lisp/dired-aux-tests.el | 27 ++++++++++++++++++++
 2 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index b81c0d1a4f..2b302e608b 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -79,6 +79,49 @@ dired--star-or-qmark-p
                (funcall (if keep #'string-match-p #'string-match) x string))
              regexps)))
 
+(defun dired--isolated-char-p (command pos)
+  "Assert whether the character at POS is isolated within COMMAND.
+A character is isolated if:
+- it is surrounded by whitespace, the start of the command, or
+  the end of the command,
+- it is surrounded by `\\=`' characters."
+  (let ((n (length command))
+        (whitespace '(?\s ?\t)))
+    (or (= n 1)
+        (and (= pos 0)
+             (memq (elt command 1) whitespace))
+        (and (= pos (1- n))
+             (memq (elt command (1- pos)) whitespace))
+        (and
+         (> pos 0)
+         (< pos (1- n))
+         (let ((prev (elt command (1- pos)))
+               (next (elt command (1+ pos))))
+           (or (and (memq prev whitespace)
+                    (memq next whitespace))
+               (and (= prev ?`)
+                    (= next ?`))))))))
+
+(defun dired--highlight-nosubst-char (command char)
+  "Highlight occurences of CHAR that are not isolated in COMMAND.
+These occurences will not be substituted; they will be sent as-is
+to the shell, which may interpret them as wildcards."
+  (save-match-data
+    (let ((highlighted (substring-no-properties command))
+          (pos 0))
+      (while (string-match (regexp-quote char) command pos)
+        (let ((start (match-beginning 0))
+              (end (match-end 0)))
+          (unless (dired--isolated-char-p command start)
+            (add-face-text-property start end 'warning nil highlighted))
+          (setq pos end)))
+      highlighted)))
+
+(defun dired--no-subst-prompt (command char)
+  (let ((highlighted-command (dired--highlight-nosubst-char command char))
+        (prompt "Confirm--the highlighted characters will not be substituted.  Proceed?"))
+    (format-message "%s\n%s " highlighted-command prompt)))
+
 ;;;###autoload
 (defun dired-diff (file &optional switches)
   "Compare file at point with FILE using `diff'.
@@ -757,11 +800,9 @@ dired-do-shell-command
          (ok (cond ((not (or on-each no-subst))
 	            (error "You can not combine `*' and `?' substitution marks"))
 	           ((need-confirm-p command "*")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `*' as a wildcard? ")))
+	            (yes-or-no-p (dired--no-subst-prompt command "*")))
 	           ((need-confirm-p command "?")
-	            (y-or-n-p (format-message
-			       "Confirm--do you mean to use `?' as a wildcard? ")))
+	            (yes-or-no-p (dired--no-subst-prompt command "?")))
 	           (t))))
     (cond ((not ok) (message "Command canceled"))
           (t
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index ccd3192792..77a4232aac 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -114,6 +114,33 @@ with-dired-bug28834-test
         (mapc #'delete-file `(,file1 ,file2))
         (kill-buffer buf)))))
 
+(ert-deftest dired-test-isolated-char-p ()
+  (should (dired--isolated-char-p "?" 0))
+  (should (dired--isolated-char-p "? " 0))
+  (should (dired--isolated-char-p " ?" 1))
+  (should (dired--isolated-char-p " ? " 1))
+  (should (dired--isolated-char-p "foo bar ? baz" 8))
+  (should (dired--isolated-char-p "foo -i`?`" 7))
+  (should-not (dired--isolated-char-p "foo 'bar?'" 8))
+  (should-not (dired--isolated-char-p "foo bar?baz" 7))
+  (should-not (dired--isolated-char-p "foo bar?" 7)))
+
+(ert-deftest dired-test-highlight-metachar ()
+  "Check that non-isolated meta-characters are highlighted"
+  (let* ((command "sed -r -e 's/oo?/a/' -e 's/oo?/a/' ? `?`")
+         (result (dired--highlight-nosubst-char command "?")))
+    (should-not (text-property-not-all 1 14 'face nil result))
+    (should (equal 'warning (get-text-property 15 'face result)))
+    (should-not (text-property-not-all 16 28 'face nil result))
+    (should (equal 'warning (get-text-property 29 'face result)))
+    (should-not (text-property-not-all 30 39 'face nil result)))
+  (let* ((command "sed -e 's/o*/a/' -e 's/o*/a/'")
+         (result (dired--highlight-nosubst-char command "*")))
+    (should-not (text-property-not-all 1 10 'face nil result))
+    (should (equal 'warning (get-text-property 11 'face result)))
+    (should-not (text-property-not-all 12 23 'face nil result))
+    (should (equal 'warning (get-text-property 24 'face result)))
+    (should-not (text-property-not-all 25 29 'face nil result))))
 
 (provide 'dired-aux-tests)
 ;; dired-aux-tests.el ends here
-- 
2.20.1


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable



WDYT?  Assuming that Dired calling unsubstituted characters
"wildcards" is indeed a problem,

- can someone come up with a better phrasing?
- is the highlighting, as implemented in this patch, helpful?
- does anybody know why `y-or-n-p' prompts lose their face property?


Thank you for your time.

K=C3=A9vin


[1] Compare:

(let ((prompt "foobar "))
  (add-face-text-property 3 6 'warning nil prompt)
  (yes-or-no-p prompt))

With:

(let ((prompt "foobar "))
  (add-face-text-property 3 6 'warning nil prompt)
  (y-or-n-p prompt))


In GNU Emacs 27.0.50 (build 2, i686-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2019-05-02 built on nc10-laptop
Repository revision: 17a722982cca4e8e643c7a9102903e820e784cc6
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: BunsenLabs GNU/Linux 9.8 (Helium)

Recent messages:
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Making completion list...
Quit [3 times]
Mark set
Quit [2 times]
Type "q" in help window to restore its previous buffer, C-M-v to scroll hel=
p.
Quit
Quit
Configured using:
 'configure --with-xwidgets'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS XWIDGETS JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  global-magit-file-mode: t
  magit-file-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  minibuffer-depth-indicate-mode: t
  icomplete-mode: t
  global-page-break-lines-mode: t
  page-break-lines-mode: t
  electric-pair-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort emacsbug sendmail nndoc gnus-dup mm-archive url-cache
debbugs-gnu debbugs soap-client url-http url-auth url-gw url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util warnings rng-xsd rng-dt rng-util xsd-regexp xml tabify man
mail-extr ffap pulse diff-hl-dired magit-patch flyspell ispell dired-aux
dired-x magit-extras hi-lock cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs cus-edit whitespace
find-dired xref magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
magit-mode transient git-commit magit-git magit-section log-edit
pcvs-util add-log with-editor async-bytecomp async server face-remap
eieio-opt speedbar sb-image ezimage dframe magit-utils crm dash shell
pcomplete ert pp gnus-async qp gnus-ml nndraft nnmh nnfolder utf-7
epa-file gnutls network-stream nsm gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime dig mailcap nntp gnus-cache gnus-sum gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time gnus-spec gnus-int gnus-range message rmc puny dired
dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums text-property-search time-date mail-utils mm-util mail-prsvr
wid-edit markdown-mode rx color noutline outline vc-mtn vc-hg jka-compr
cl-print debug backtrace find-func thingatpt help-fns radix-tree
executable misearch multi-isearch vc-git vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs project delight advice eighters-theme quail cl-extra
help-mode rg rg-ibuffer rg-result wgrep-rg wgrep s rg-history rg-header
rg-compat ibuf-ext ibuffer ibuffer-loaddefs grep compile comint
ansi-color ring edmacro kmacro disp-table paren mb-depth icomplete
page-break-lines elec-pair diff-hl-flydiff diff diff-hl vc-dir ewoc vc
vc-dispatcher diff-mode easy-mmode delsel cus-start cus-load mule-util
tex-site info package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 708714 111581)
 (symbols 24 31862 1)
 (strings 16 136515 44484)
 (string-bytes 1 4039230)
 (vectors 8 60958)
 (vector-slots 4 1347636 61628)
 (floats 8 3359 1168)
 (intervals 28 69005 689)
 (buffers 564 56))

--=-=-=--




Acknowledgement sent to Kévin Le Gouguec <kevin.legouguec@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#35564; 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: Mon, 29 Jul 2019 18:30:02 UTC

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