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: Sun, 27 Feb 2022 11:17:08 +0100 Message-ID: <87wnhgtxzv.fsf@gmail.com> References: <87a6edi8b3.fsf@gmail.com> <835yp0pzoh.fsf@gnu.org> <87wnhgwxo8.fsf@gmail.com> <83tuckogza.fsf@gnu.org> <87sfs4wv35.fsf@gmail.com> <83sfs4oe56.fsf@gnu.org> 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="21126"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54173@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 27 11:18:12 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 1nOGd1-0005LK-3k for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Feb 2022 11:18:11 +0100 Original-Received: from localhost ([::1]:43800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOGcz-0002sM-PT for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Feb 2022 05:18:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOGcs-0002sA-37 for bug-gnu-emacs@gnu.org; Sun, 27 Feb 2022 05:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOGcr-00042l-Pf for bug-gnu-emacs@gnu.org; Sun, 27 Feb 2022 05:18:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nOGcr-0000q4-Hm for bug-gnu-emacs@gnu.org; Sun, 27 Feb 2022 05:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Feb 2022 10:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54173 X-GNU-PR-Package: emacs Original-Received: via spool by 54173-submit@debbugs.gnu.org id=B54173.16459570393175 (code B ref 54173); Sun, 27 Feb 2022 10:18:01 +0000 Original-Received: (at 54173) by debbugs.gnu.org; 27 Feb 2022 10:17:19 +0000 Original-Received: from localhost ([127.0.0.1]:56895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOGcA-0000p6-KM for submit@debbugs.gnu.org; Sun, 27 Feb 2022 05:17:18 -0500 Original-Received: from mail-ed1-f50.google.com ([209.85.208.50]:44973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOGc8-0000or-I3 for 54173@debbugs.gnu.org; Sun, 27 Feb 2022 05:17:17 -0500 Original-Received: by mail-ed1-f50.google.com with SMTP id x5so13435769edd.11 for <54173@debbugs.gnu.org>; Sun, 27 Feb 2022 02:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=c9Ohne0RpXy46lPcTkdjU+oqJlqUxkEGfQ5pCi0O9Kk=; b=bvT/Bs6Rd4vn+CHkMD1xvgtOR2iKdXQjD/oMisAaESjcZn0sC8feyho6SHbXWxOVot U7hoNhUzCy3CSbdfHiS7vIfYdOVt/N8SiKWrnWt1EyGR+TnEZ1hY0Sji+jOkqZHN7MOA 1VeGUBxydyBI1ngLgFUX+MyAz3deFuGeRD4gqZDAAUh3K1Sp4LGmo2a91I4NxjNBe4Y9 vbTRMzOHsOZbEHSAJxVmc2J0dyeBs/qEewbcBdmDCVgvX5zGL1NdvmTpkzc28Fd2S6l3 9kgDP9IyHrslKWPxT75ZvYuYQ62/oUlRLO9a7whTrPWT1HnNfN7imA4tF4wnfBDFh+LU SDfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=c9Ohne0RpXy46lPcTkdjU+oqJlqUxkEGfQ5pCi0O9Kk=; b=rbqQmsabW54vDAFz6mQjbprE2PrKC3dT7b7AONVf9Tl0gJNvFDnKi2p3Oj1A0a4RN9 vxOdgTFLDQ4836wyanVBqE/pInGLnoALBJPlspL7nUUO/ywSPhlk3sMyhhwwgnNSyeXe Q+UPbkDCPnvfaebh7bcDfR9++3mN9ZbZQumTXfYOZjI2Yyr16eGduUh9rmHcDcVag535 nhCPRkQVmBjK1oa0E661p5ZjW9hue1Tda88P+Tws9x8VGPaNaM3kdhkZ7roA0tHSO0F/ gtbL7yvrvNY/n+of9a7zv8qejwd+92UAB/fHbnc2/RL20piJaylwTMVo6hkPX2HKYXR3 V04Q== X-Gm-Message-State: AOAM5338HHnguWqM2FiBEqzQi1D1UYyGMncitaqGcKlJ0/GcA9l960V4 i6rF9lDefdyw4Ak4wCYEAmYcddsgGBf6pA== X-Google-Smtp-Source: ABdhPJwjlFl9YQlHvsYjLQJ/H1SDVj+zYhRvNVmxWi6r9xhKaLb2dZeh/RORJgOoYt55GeGRgVdROw== X-Received: by 2002:aa7:c446:0:b0:410:9a8e:9b85 with SMTP id n6-20020aa7c446000000b004109a8e9b85mr14215233edr.319.1645957030362; Sun, 27 Feb 2022 02:17:10 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::758e]) by smtp.gmail.com with ESMTPSA id v5-20020a056402184500b00412e1a73c7bsm4250154edy.61.2022.02.27.02.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 02:17:09 -0800 (PST) In-Reply-To: <83sfs4oe56.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 27 Feb 2022 11:24:53 +0200") 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:227709 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, 27 Feb 2022 at 11:24, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Cc: 54173@debbugs.gnu.org >> Date: Sun, 27 Feb 2022 09:51:42 +0100 >>=20 >> > But since '?' produces a more detailed help, and that help text stays >> > on display thereafter, do we really need one more variant? Maybe the >> > default message could be expanded instead (but not to such a long >> > text, which would resize the mini-window in many cases)? >>=20 >> I think =E2=80=98y=E2=80=99 and =E2=80=98n=E2=80=99 are intuitive enough= that they don't need a >> reminder. But mentioning the more uncommon ones (=E2=80=98.=E2=80=99 an= d so on) without >> talking about =E2=80=98y=E2=80=99 and =E2=80=98n=E2=80=99 is weird. > > How about the below? > > (=E2=80=98y=E2=80=99/=E2=80=98n=E2=80=99, =E2=80=98.=E2=80=99 replace &= exit, =E2=80=98^=E2=80=99 back up, =E2=80=98?=E2=80=99 help) I find this better than the status quo. I've attached the patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Expand-help-string-in-perform-replace-prompt.patch >From 290ad346d793d42c654adbde87089b22f4aa0fa5 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Sat, 26 Feb 2022 23:08:26 +0100 Subject: [PATCH] Expand help string in 'perform-replace' prompt * lisp/replace.el (query-replace-prompt-help): New variable, 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 'query-replace-prompt-help. --- lisp/replace.el | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index 06be597855..49cf652ddc 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2445,18 +2445,22 @@ query-replace-help in the current buffer." "Help message while in `query-replace'.") +(defvar query-replace-prompt-help + "\\(\\[act]/\\[skip], \\[act-and-exit] replace & exit, \\[backup] back up, \\[help] help)" + "Help string to show next to the `query-replace' prompt.") + (defvar query-replace-map (let ((map (make-sparse-keymap))) (define-key map " " 'act) (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 +2844,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 query-replace-prompt-help))))) ;; Unless a single contiguous chunk is selected, operate on multiple chunks. (when region-noncontiguous-p -- 2.35.1 --=-=-= Content-Type: text/plain > An alternative is to have C-h and F1 temporarily show a longer line > with more commands. > >> One idea would be to choose between the short and long messages based on >> the size of the miniwindow as well as the length regexp and replacement >> text. > > That could also be a possibility. Between this and your suggestion, I'm undecided what's better. Perhaps this is more complicated than necessary. --=-=-=--