From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#35564: [PATCH v4] Tweak dired warning about "wildcard" characters Date: Fri, 09 Aug 2019 14:43:12 +0200 Message-ID: <87k1bmfr1b.fsf@gmail.com> References: <87zho2cd4f.fsf@gmail.com> <87wohvf22u.fsf@gmail.com> <87h88cvpkj.fsf_-_@gmail.com> <87imsinbmr.fsf_-_@gmail.com> <87y313z3tp.fsf@gmail.com> <83wog3lo5c.fsf@gnu.org> <87wog3pewu.fsf@gmail.com> <87v9vndsnj.fsf@web.de> <87imrl4ixr.fsf@web.de> <87r2688y1l.fsf@gmail.com> <87sgqkjfxv.fsf@web.de> <87tvas2b5o.fsf@gmail.com> <87d0hffjda.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="255931"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Michael Heerdegen , 35564@debbugs.gnu.org, monnier@iro.umontreal.ca, npostavs@gmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 09 14:44:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hw4Fe-0014Pm-16 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Aug 2019 14:44:10 +0200 Original-Received: from localhost ([::1]:58994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw4Fc-00076U-Fq for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Aug 2019 08:44:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52236) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw4FX-00075l-Ro for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 08:44:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hw4FW-0007iF-Kc for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 08:44:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hw4FW-0007iB-HP for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 08:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hw4FW-0007sc-Ch for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 08:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Aug 2019 12:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35564-submit@debbugs.gnu.org id=B35564.156535460430233 (code B ref 35564); Fri, 09 Aug 2019 12:44:02 +0000 Original-Received: (at 35564) by debbugs.gnu.org; 9 Aug 2019 12:43:24 +0000 Original-Received: from localhost ([127.0.0.1]:42132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hw4Eu-0007rZ-1t for submit@debbugs.gnu.org; Fri, 09 Aug 2019 08:43:24 -0400 Original-Received: from mail-wr1-f67.google.com ([209.85.221.67]:33574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hw4Es-0007rM-G7 for 35564@debbugs.gnu.org; Fri, 09 Aug 2019 08:43:23 -0400 Original-Received: by mail-wr1-f67.google.com with SMTP id n9so98237738wru.0 for <35564@debbugs.gnu.org>; Fri, 09 Aug 2019 05:43:22 -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=uUqSjynX8LJX1p7IFxS057aC711CPYEur3A1lCCs+R4=; b=eAzd3cGg6REEdD4YV+WTEWTZptwHJBqQRMAY18vgITokbHU6BNjyyn6gmO6Vxzwrl+ xSSyF7bIi/jxzobfGA2jtWmDTfTlhhTv3Pgnw4U36uj3rISXd1f6ZcqzveMIbjyUZaoC kI9BgnUOHmbbUQOZ4+DfRw6B7gCiK5WWo7B9jtZDDUFxoob7jjubB8fo0oPPzTj0pKcG ixy6OAs37EVQoAHfZ0ohtTiCoucmx4/rwyMzajHrKl0SHp2/UtioekZk1yRoZxHKFjL5 xW6T1748SvSTH+RRizY1uxW1RrZBh1OR1m72wUMxZc/zZFaMP1/aqgCXsgmzYTEg3ueW ZqdA== 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=uUqSjynX8LJX1p7IFxS057aC711CPYEur3A1lCCs+R4=; b=R7tOxx7ACGqD8VtyxlxtIG+Q8guTkhsV9/xiu64uorWvvodpIhPqEUckJ2y6HfIV6v YlsmXooh3AvlYA/ItqXfsbp5HZ16wKP4WclwV7X7AnJwnl/7ThIr0wssneGGPQgdp7TC h9dqHYQJvk2PZBY54CFjzoeHntU6K2qzRlM/Lvid782txnGTePo0QlfYIkDgfFYJLJPf 0mhkSiZ8Z24UMSfsvim6OJxnlwxIfxEqq61pT13JaoPM3wA3zBpRlpTk1thwVUf0Cr61 JDHejzKvmJaq4vjoNIloh5Q6VqMfpr8MWoFdPCx7jLPvJbPxwoC5qm6XbphGSMCFut4N n22A== X-Gm-Message-State: APjAAAXR/KKXyUf9Ou5CJ5RdyguvZ81PGJ/yPTILxfB79vlq0bjyB/sO 3S5n6N8sO+tLs1rupEaU/+s= X-Google-Smtp-Source: APXvYqwH3Hnw40GMH08Kg1hC7UH+KiJDef+jzVg6FE3A7Pro1bmpUhlyz6snBndC0i4PTfi5/F824Q== X-Received: by 2002:adf:e5c4:: with SMTP id a4mr9353231wrn.87.1565354596575; Fri, 09 Aug 2019 05:43:16 -0700 (PDT) Original-Received: from nc10-laptop (2a01cb04010fc800c8771fb97d0446e3.ipv6.abo.wanadoo.fr. [2a01:cb04:10f:c800:c877:1fb9:7d04:46e3]) by smtp.gmail.com with ESMTPSA id c1sm216774828wrh.1.2019.08.09.05.43.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Aug 2019 05:43:13 -0700 (PDT) In-Reply-To: <87d0hffjda.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 09 Aug 2019 00:06:33 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164799 Archived-At: Juri Linkov writes: > I use the substitution feature in dired-do-shell-command quite rarely, > but today I needed to use it, and it strikes as partly unusable > and confusing. Welcome to the club :) > 2. The current question is too ambiguous: > > Confirm--do you mean to use =E2=80=98?=E2=80=99 as a wildcard? (y or n) > > A wildcard can mean both dired substitution and shell substitution. > A better question should use the same terms as documented in the > docstring of `dired-do-shell-command', i.e. "marked files", "file list". > So a better question would be: > > Confirm--do you mean to substitute =E2=80=98?=E2=80=99 with marked file= s? (y or n) > > Or something similar that makes clear that substitution applies > to dired files, not files matched by shell. Mmm, I think that the current prompt *does* use the same terms as documented in the docstring: it simply mistakenly assumes that if '?' and '*' are not "isolated", the shell will unconditionally process them as wildcards. It is a heuristic that fails to consider that '?' and '*' may be quoted or escaped. So with this prompt, "yes" means "yes, I want the shell to (possibly) substitute these characters", while "no" means "By Jove, what a silly mistake I was about to make! Thank you ever so much for catching it Dired old chap! Let me add some backquotes around this '?' so that you can be sure I mean for you to substitute it for the marked files." IIUC, your suggested prompt does not match what dired-do-shell-command actually does: the function only ever substitutes '?' if it is "isolated", i.e. surrounded with whitespace or backquotes. Cf. the docstring: > =E2=80=98*=E2=80=99 and =E2=80=98?=E2=80=99 when not surrounded by whites= pace nor =E2=80=98`=E2=80=99 have no special > significance for =E2=80=98dired-do-shell-command=E2=80=99, and are passed= through > normally to the shell, but you must confirm first. (Drew suggested that we may want to change *the code* to behave as your prompt suggests[1], I sketched a possible way to let the user select which occurrences to substitute[2], but did not act on it as AFAICT this use-case is already handled by adding backquotes around '?') >> What bothers me is that even if we can assert #2, nothing guarantees >> that these colors will be distinguishable *to the user* (who may >> e.g. have some form of color blindness). It would therefore be nice if >> this user could force Emacs to use ^ markers; I guess that would involve >> a new variable. > > As was already discussed in this thread, using (:inherit '(warning underl= ine)) > will solve this problem and improve accessibility. So there will be > no need in multi-line prompt when using underline face attribute. Mmm. I went to a TTY to check how (:inherit '(underline)) looks. Since (display-supports-face-attributes-p '(:underline t)) is nil there, the "underline" face is defined as (:weight bold), which merely makes the foreground color brighter. So (:inherit '(warning underline)) amounts to just (:inherit '(warning)). Perhaps (display-supports-face-attributes-p '(:underline t)) can be used to decide whether we need to add ^ markers. [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35564#89 [2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28969#19