From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#54173: 28.0.91; Training wheels for query-replace Date: Sat, 26 Feb 2022 23:15:12 +0100 Message-ID: <87a6edi8b3.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2347"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) To: 54173@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 26 23:16:25 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nO5MW-0000Rk-NO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Feb 2022 23:16:24 +0100 Original-Received: from localhost ([::1]:53340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO5MV-00029Q-69 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Feb 2022 17:16:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO5MB-00029B-53 for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2022 17:16:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO5MA-0001G5-Fp for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2022 17:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nO5MA-0002yy-9C for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2022 17:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Feb 2022 22:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54173 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164591372211403 (code B ref -1); Sat, 26 Feb 2022 22:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Feb 2022 22:15:22 +0000 Original-Received: from localhost ([127.0.0.1]:56411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO5LV-0002xr-Qo for submit@debbugs.gnu.org; Sat, 26 Feb 2022 17:15:22 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:43792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO5LT-0002xi-SM for submit@debbugs.gnu.org; Sat, 26 Feb 2022 17:15:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO5LT-00021t-Ai for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2022 17:15:19 -0500 Original-Received: from [2a00:1450:4864:20::634] (port=34356 helo=mail-ej1-x634.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO5LR-00012y-Ek for bug-gnu-emacs@gnu.org; Sat, 26 Feb 2022 17:15:18 -0500 Original-Received: by mail-ej1-x634.google.com with SMTP id gb39so17689234ejc.1 for ; Sat, 26 Feb 2022 14:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version; bh=7rzzfAjCSVZMCOI65r+jvRxKaBhCvkulq593SVyH6JI=; b=Pufkb3G31Bk6Qcbw/o0jcW4QaK6xpd8rC056D+LhWoxe6K+UsJn1C/lukg0RMIjfs3 bRX778qNuyYmX7ZccZBnOODUyEz3gYVXGMVuB5adp73okgAaqN0gO+SdUMWwbcyXs1EG 5Ipg1RhHZ9vRaQtxP49hoA7xTcIiYl1WpLhnVUl9/MpVwlPTgvJmtMgy01bcpn/wgNLx 4Z47kL7JkyMCBAUJ0uA5SeVug8hcd7nGgX+i0W5D8kEtuJSiALv7tiiKwQk4a/lxfcC+ YP9lj4+9za0jGu6IbSqofg8inznXzSNrjxsSj34WmsJkPvJYyZI/JPUYIUppdFia9l08 G0Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=7rzzfAjCSVZMCOI65r+jvRxKaBhCvkulq593SVyH6JI=; b=ZuZQJVJBUDKXKPdjKYuQvcfTjmFz4i8Z+KKch2PcjjXQqIjTtmcxrYz2qxTfjT9wq1 5EQ+wXMbzqOMOQbBqRVjBkMSAIEyH5MnohrGnXpg9g+tDipPrRWWIqI7QaM4Cz6x3VhQ LRq1hKncRSPdCMNDTePH+LUg3l0vP5e6dLq65vdWj/LP6KinLaOVpYVnhye393lA3TrP jiPyNjifoV+E4otHPLx6khRAmZyMQjGgfT8xbKg97uPlvwWBGWFRzQa7zmhFrc3rTs4V 4Jh6zPomNSlP6lkUMmhgvYLT6zeXsc8+mdt7R57ZvVEVeWMKPtc90N+f+y74+rgpZJzm wYXg== X-Gm-Message-State: AOAM530ga1BUD/rplI3gOzm/jkErliFJOpWAUXcy9P0e359GHiucAGtz 3kZxtyufxdcbDZCbNYbCNmEuwMnrW8u3Iw== X-Google-Smtp-Source: ABdhPJyZ5jcFwqd1sBoOSCH3S0J7TMuf+81qJ4my1ZGLFJMMftLg0hNukw7MyRAzFpSt4UiSy+kfkw== X-Received: by 2002:a17:906:199a:b0:6d1:aa59:2927 with SMTP id g26-20020a170906199a00b006d1aa592927mr10258525ejd.215.1645913714835; Sat, 26 Feb 2022 14:15:14 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::758e]) by smtp.gmail.com with ESMTPSA id w19-20020a17090633d300b006ce3d425b22sm2690438eja.1.2022.02.26.14.15.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 14:15:13 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::634 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:227689 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I've been using query-replace for years but still seem to have trouble remembering some of the keys. How about making the help message next to the prompt =E2=80=9C(? for help)=E2=80=9D customizable, with an option to i= nclude an extra summary line? See patch attached (note that it also slightly changes the faces of the prompt). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-perform-replace-prompt-help-customizable.patch >From 80710d38d9335101108661a9685c449be2d56fde Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 26 Feb 2022 23:08:26 +0100 Subject: [PATCH] Make 'perform-replace' prompt help customizable * lisp/replace.el (perform-replace-prompt-help): New defcustom, help string shown next to 'perform-replace' prompt. (query-replace-map): Reorder entries so that 'substitute-command-keys' does the right job. (perform-replace): Use 'perform-replace-prompt-help. --- lisp/replace.el | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index 06be597855..c9300a22e4 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -148,6 +148,18 @@ query-replace-lazy-highlight :group 'matching :version "22.1") +(defcustom perform-replace-prompt-help "\\(\\[help] for help)" + "Help string to show next to the `perform-replace' prompt." + :type '(choice (const :tag "Just advertise help" + "\\(\\[help] for help)") + (const :tag "One-line summary" + "\\(\\[help] for help) +Replace \\[act] once, \\[act-and-exit] and exit, \\[automatic] all; \ +skip to \\[skip] next, \\[backup] previous; \ +\\[undo-all] undo all.")) + :group 'matching + :version "29.1") + (defface query-replace '((t (:inherit isearch))) "Face for highlighting query replacement matches." @@ -2451,12 +2463,12 @@ query-replace-map (define-key map "\d" 'skip) (define-key map [delete] 'skip) (define-key map [backspace] 'skip) - (define-key map "y" 'act) - (define-key map "n" 'skip) (define-key map "Y" 'act) + (define-key map "y" 'act) (define-key map "N" 'skip) - (define-key map "e" 'edit-replacement) + (define-key map "n" 'skip) (define-key map "E" 'edit-replacement) + (define-key map "e" 'edit-replacement) (define-key map "," 'act-and-show) (define-key map "q" 'exit) (define-key map "\r" 'exit) @@ -2840,20 +2852,20 @@ perform-replace (match-again t) (message - (if query-flag - (apply #'propertize - (concat "Query replacing " - (if backward "backward " "") - (if delimited-flag - (or (and (symbolp delimited-flag) - (get delimited-flag - 'isearch-message-prefix)) - "word ") "") - (if regexp-flag "regexp " "") - "%s with %s: " - (substitute-command-keys - "(\\\\[help] for help) ")) - minibuffer-prompt-properties)))) + (when query-flag + (concat + (apply #'propertize + (concat "Query replacing " + (if backward "backward " "") + (if delimited-flag + (or (and (symbolp delimited-flag) + (get delimited-flag + 'isearch-message-prefix)) + "word ") "") + (if regexp-flag "regexp " "") + "%s with %s: ") + minibuffer-prompt-properties) + (substitute-command-keys perform-replace-prompt-help))))) ;; Unless a single contiguous chunk is selected, operate on multiple chunks. (when region-noncontiguous-p -- 2.35.1 --=-=-=--