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: 27.0.50; [PATCH] Tweak dired-do-shell-command warning about "wildcard" characters Date: Mon, 06 May 2019 21:40:01 +0200 Message-ID: <877eb3e5im.fsf@gmail.com> References: <87zho2cd4f.fsf@gmail.com> <071cc96c-1bf2-f331-8f9e-b3c54a7452da@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="24140"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 35564@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 06 21:41:15 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNjUB-0006AF-4O for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 May 2019 21:41:15 +0200 Original-Received: from localhost ([127.0.0.1]:33104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNjUA-0002sF-19 for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 May 2019 15:41:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNjTz-0002s2-RJ for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 15:41:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNjTy-0004ni-Kl for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 15:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNjTy-0004nY-Cv for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 15:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hNjTy-0008I0-5x for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 15:41: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: Mon, 06 May 2019 19:41: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.155717161731787 (code B ref 35564); Mon, 06 May 2019 19:41:02 +0000 Original-Received: (at 35564) by debbugs.gnu.org; 6 May 2019 19:40:17 +0000 Original-Received: from localhost ([127.0.0.1]:57484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNjTE-0008Gd-J9 for submit@debbugs.gnu.org; Mon, 06 May 2019 15:40:16 -0400 Original-Received: from mail-wr1-f46.google.com ([209.85.221.46]:38624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNjT9-0008GG-NZ for 35564@debbugs.gnu.org; Mon, 06 May 2019 15:40:15 -0400 Original-Received: by mail-wr1-f46.google.com with SMTP id k16so18840895wrn.5 for <35564@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) Original-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) In-Reply-To: <071cc96c-1bf2-f331-8f9e-b3c54a7452da@gmx.at> (martin rudalics's message of "Sun, 5 May 2019 10:44:21 +0200") 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:158841 Archived-At: --=-=-= Content-Type: text/plain martin rudalics 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?= 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 --=-=-=--