From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#46515: Repeat mode Date: Mon, 15 Feb 2021 11:17:31 +0200 Organization: LINKOV.NET Message-ID: <87sg5xy85o.fsf@mail.linkov.net> References: <87pn12o74z.fsf@mail.linkov.net> 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="32810"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 46515@debbugs.gnu.org To: Matt Armstrong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 15 10:55:44 2021 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 1lBabY-0008R2-0P for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Feb 2021 10:55:44 +0100 Original-Received: from localhost ([::1]:56998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBabX-0006U0-1u for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Feb 2021 04:55:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBaX1-0000lk-3j for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 04:51:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBaX0-0007lh-Ms for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 04:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lBaX0-0000mb-CT for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 04:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Feb 2021 09:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46515 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46515-submit@debbugs.gnu.org id=B46515.16133826392974 (code B ref 46515); Mon, 15 Feb 2021 09:51:02 +0000 Original-Received: (at 46515) by debbugs.gnu.org; 15 Feb 2021 09:50:39 +0000 Original-Received: from localhost ([127.0.0.1]:37276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBaWd-0000lu-9t for submit@debbugs.gnu.org; Mon, 15 Feb 2021 04:50:39 -0500 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:56669) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBaWZ-0000lS-ND for 46515@debbugs.gnu.org; Mon, 15 Feb 2021 04:50:36 -0500 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 80889200009; Mon, 15 Feb 2021 09:50:28 +0000 (UTC) In-Reply-To: (Matt Armstrong's message of "Sun, 14 Feb 2021 15:59:32 -0800") 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:200047 Archived-At: --=-=-= Content-Type: text/plain > First thing: neat idea, and don't listen to me. :-) Thanks, I really appreciate your help. > Have you thought about making it more clear to the user that their keys > are now doing different things? Most successful "modal" interfaces I > have seen have clear indicators. I have already thought about using prefix-command-echo-keystrokes-functions, but failed to do this, so abandoned this attempt. I did not realize it's possible to do this simply with messages like you pointed out here :-) > One idea is to look at the other places in Emacs that already use > `set-transient-map' in this way and try to be "at least as good" as > those. `kmacro' and `indent-rigidly' are two reasonable examples. They > print messages when active that describe the newly active key bindings. I use `indent-rigidly' many times every day, but never noticed that it prints the message Indent region with , , S-, or S-. It goes unnoticed maybe because it's displayed only once at its activation. > repeat.el doesn't describe the key binding, but it does say a repeat > mode is active. Kmacro is so smart that it aranges for the repeat key to > be based on whatever key the command was invoked with. Unlike `indent-rigidly', `kmacro' message (Type e to repeat macro) is displayed on every keypress, so it's a good example. Now added in the following patch applied over the previous patch. > As far as this general approach for creating small transient modes, I > can't help but think it is too low level. An approach that had a bit > more scafolding to it would let Emacs' help system describe it, and it > might allow for a consistent way for Emacs to indicade they are active > --- similar to how the conventions under major and minor work for > "heavier" modes. Currently I have no idea how this could be generalized. But simply describing it in the help system should be quite easy to do, so e.g. 'C-h k C-x o' could check for the command's repeat keymap and add a help string about its repeatability. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=repeat-message.patch diff --git a/lisp/repeat.el b/lisp/repeat.el index 896a95197a..3c8be63c84 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -360,6 +360,9 @@ repeat-post-hook (when (boundp repeat-map) (setq repeat-map (symbol-value repeat-map))) (let ((map (copy-keymap repeat-map))) + (let (keys) + (map-keymap (lambda (key _) (push (key-description (vector key)) keys)) map) + (message "To repeat type %s" (mapconcat #'identity keys ", "))) (when repeat-exit-key (define-key map repeat-exit-key 'ignore)) (set-transient-map map)))))) --=-=-=--