From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ramesh Nedunchezian Newsgroups: gmane.emacs.bugs Subject: bug#47688: 28.0.50; repeat-mode: Make rectangle commands repeatable. Also some misc. queries, comments Date: Sat, 10 Apr 2021 13:53:06 +0530 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 To: 47688@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 10 10:24:11 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 1lV8uZ-0003RD-54 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 10:24:11 +0200 Original-Received: from localhost ([::1]:48868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lV8uX-00021b-Vh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Apr 2021 04:24:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lV8uR-00021T-2b for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 04:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39851) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lV8uQ-00061B-RB for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 04:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lV8uQ-0005AZ-NZ for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 04:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ramesh Nedunchezian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Apr 2021 08:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47688 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.161804300619816 (code B ref -1); Sat, 10 Apr 2021 08:24:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Apr 2021 08:23:26 +0000 Original-Received: from localhost ([127.0.0.1]:51397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV8tq-00059Y-3H for submit@debbugs.gnu.org; Sat, 10 Apr 2021 04:23:26 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV8to-00059Q-Bs for submit@debbugs.gnu.org; Sat, 10 Apr 2021 04:23:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lV8to-0001yB-61 for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 04:23:24 -0400 Original-Received: from mail-oln040092255097.outbound.protection.outlook.com ([40.92.255.97]:27072 helo=APC01-HK2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lV8tk-0005ZW-ID for bug-gnu-emacs@gnu.org; Sat, 10 Apr 2021 04:23:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ogQJNpDQ9/sxBVJy2XY0iWEXqIIhOT3SLbNRvaNJ00ZrUSFkVEGD/elqXkXOg5lGxI5J3yQXM+qkqQg4nfoNSAormZcO501/s8VNVhkW8+gTLgbW5xop6n1lymeq8Y0qrC/I64dNWaC6kiUsKyPVR5Z7ULwN6vm2YNcjOVa1oBezvkns285uWRgRSd3PZ+KrXYA+r55CP2dj2FfmVagGe7an6rw/sinxETWLDkT1VKNQtexIFNUPXqQBZxnNsQ+rDlHVArEwuyFoJFv2207ht+KLHuq0CYap4e1E0aI3NUO+bmQjh43Hdgk+InAYVtfTWRZWLlUFa7Ih4Ooo1uWCVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X7QAmC47OfymWIY8ystp4ZxjOp89Xe1WamyvheRb3OM=; b=cQAVN1KW3NJVgmWZfWgANCbRqBzBcC7QslZLB+iB7T35ix8RDdoihEc/RogJJkRHlVnKc1X3R9RgnGFJ7BdafrXimt8/L8MPzf6DNZI8LXnyRkBgpsPUNM/knQGt19SbM9VVV+ykwlTs9KI4cM4dFqBbhCVVrEYMPf+rlQ/zq/LtKXzpZdznlyJW/tp6Blx1XCd26L3L4K04dsweGFpvvJyo1KG7PM6aZaVDPvsC9S35cuLhPLBxgtt4Jr0hZKJB5gkRyOhF5eDEXnNu1QAKrqGDNGKo6hsnQj30ADrNCuDf3vSwEuc0SeS/pRlPRJ7rmok9iuKOhJ97Kg1OuE98kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X7QAmC47OfymWIY8ystp4ZxjOp89Xe1WamyvheRb3OM=; b=kIxpuLjx/zyeV/xbjrAKMtLdGMhSR9o22dbaGZHFcvCB+ufZZABmc/rJjzenZaOfk1Gx04EbSOQyCUpuLrRUF0EJJW/zezsgumhlIkjByx4XElHA2kRUoKcz9djnasbWxeJ4r7j0AEAyU4TTYZ06TIWLr0vKN5LV1/AHXI1jl+S20WGcZKaTsJGFbXzDvzlLi0sKwNSvBAsIHVVQ/MCZ6oFNkGR4pjnTVBX0SUdLsUQHz2M/EczlzpuCf+po/UsDzJORbnwu4uERn//hYFgJxr7nEikmXH6P0a0Pvx5r8uQ2gR+66KHBVVxzKZbcelgsKaiMlC5HWfO80NtFKF6Ltg== Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) by TY2PR0101MB3309.apcprd01.prod.exchangelabs.com (2603:1096:404:f2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Sat, 10 Apr 2021 08:23:11 +0000 Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::4980:4d7f:474b:de2c]) by TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::4980:4d7f:474b:de2c%3]) with mapi id 15.20.4020.018; Sat, 10 Apr 2021 08:23:11 +0000 Content-Language: en-US X-TMN: [hQ4r8vAJpTQA/oFymZu6A/af4hxpeYVZ+RJEt9hdwUVidSIqHOiV2N8xZkN1b94ltEEjLoYwhb4=] X-ClientProxiedBy: MAXPR0101CA0064.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::26) To TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) X-Microsoft-Original-Message-ID: X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from [IPv6:2401:4900:330d:5d93:fc95:fa5e:bce5:8b48] (2401:4900:330d:5d93:fc95:fa5e:bce5:8b48) by MAXPR0101CA0064.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Sat, 10 Apr 2021 08:23:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77f7a7f8-9f2e-44b9-c6bc-08d8fbf9e0c7 X-MS-TrafficTypeDiagnostic: TY2PR0101MB3309: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d7vCOPisbNjXTyVQN57zEgoEbhGHcIBs6W+8B7USycOrnTr/20tQzbnbqYf2YOJPgH+yPjZ2pXZGMo0KX6pxu5vT1XR8TJFr6eO6E9Xs6Z0friOD9LNLPGZ3CiEGNQXkIMfe3BXxYnu3pN8V6+eJY8X2Xjq7twUylOdfT6gYuyCiNYh98stpkBVCmpGlf23tUt/ArJfmUGRHC/4YdPQLsrG/565fMsEarFCMSSp8VyLiqqahhl40DR1l9nreHORpv5r3NiorfBB0q+1LwcogRfgzqev40Av0+MffzDDldSu4jwyz05xYrJ3Gxp3zMbml/PC5ZcvNWxOKV05eEHNlkov2uDQ+6Gz1MuJR5BLNRfAB8ziOKZiCltHGGCL4iIKmHKsS++ILCsXdmc/gz3spJQ== X-MS-Exchange-AntiSpam-MessageData: zzat1oBUYN0fEEWqiGKODAbINc8qb+jv1iTcQ2eMIU/ea4mhmjimdxAKT0I/gsue7DSAvFjZH1cElk8V0ZLM1o8yleU/65ACYEaBXYf/o4bcLnjLRf9vMvjYPrnEet+fjAWPFA6D5VWcCm2VlnnAHxhfDOj4kLUkDd7Oq6NO5HJvj0cmGAhgJf7zj3MDqd2+i2keCWiEuK3uFmjm8ug4Ew== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77f7a7f8-9f2e-44b9-c6bc-08d8fbf9e0c7 X-MS-Exchange-CrossTenant-AuthSource: TY2PR0101MB3693.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 08:23:11.8015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR0101MB3309 Received-SPF: pass client-ip=40.92.255.97; envelope-from=rameshnedunchezian@outlook.com; helo=APC01-HK2-obe.outbound.protection.outlook.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 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, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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:203786 Archived-At: Could you please add rectangle commands to the repeatable set? This is what I have in my .emacs. It works reasonably well, except for the `x' (- `rectangle-exchange-point-and-mark') key below: Issue 1: -------- In Non-repeat mode, 1. Press C-x SPC and make a rectangel. 2. Press C-x C-x 4 or more times. You will see the cursor jumping between the corners. With below snippet installed, in repeat-mode, repeat the above operations with single key strokes. I am seeing that the 3rd press of x gets me out of the repeat loop and inserts the char "x" in the buffer. Issue 2: A repeat map can provide a custom `:help'-er ----------------------------------------------------- This is the message I see in the minibuffer. Repeat with c, ESC, w, r, d, k, o, b, C-b, x, C-x, f, C-f, , SPC, , C-n, N, , C-p, , t, y 1. `ESC' above correpsonds to `M-w' in the repeat map. The single character `ESC' confused me for some time. I wonder if the help text could be improved in this case. 2. The help text is really really big, and it clutters the echo area. It seems that .... Repeatable keys are essentially a poor-man's hydra, So, a repeat-map, like the rectangle one below, which has lots of keybindings can set a `:help' attribute on itself. `repeat-post-hook' can then rely on this `:help'-er to provide a help much similar to what the hydra package provides. Issue 3: A repeat map can take `:keep-pred' (or a `:exit-key') and other properties. ---------------------------------------------------------------------------- When looked askance, `repeat-post-hook' is essentially a wrapper around `transient-map'. So, a `repeat-map' can take a `:keep-pred' and `:on-exit' attributes, in addition to a `:help' attribute. This will obviate the need for the global `repeat-exit-key' i.e., the choice of how the map exits should itself be delegated to the repeat map. ` Suggestion 1: Provide a macro(?) for creating repeatable commands. ------------------------------------------------------------------ Provide a defmacro for creating repeatable keymaps. The snippet below is actually created by my own `defmacro'. The macro takes an list of (KEY . CMD) and a name of repeat map and generates what you see below. (Bonus points, if the API invocation looks much similar to `bind-key' section in a in a `use-package' directive) The rectangle commands itself come from two different maps `ctl-x-r-map' and `rectangle-mark-mode-map'. The first one has /non-rectangle/ commands like register commands. If the repeatable commands all come from a single map (and if there are no other commands in that map), then there is NO need for this API. One could do something what diff-hl already does (map-keymap (lambda (_key cmd) (put cmd 'repeat-map 'diff-hl-command-map)) diff-hl-command-map) The need for this APIs arise only because one is collecting the keys from disparate maps. Suggestion 2: ------------ Provide a defmacro for chained commands. I am making the suggestion here. I will provide details in a separate bug report. ---------------------------------------------------------------- Snippet for making rectangle commands repeatable. ------------------------------------------------- (progn (defvar rectangle-repeat-map (let ((map (make-sparse-keymap))) map)) (cl-loop for (cmd . key-sequence) in `( (clear-rectangle . "c") (copy-rectangle-as-kill . ,(kbd "M-w")) (copy-rectangle-as-kill . "w") (copy-rectangle-to-register . "r") (delete-rectangle . "d") (kill-rectangle . "k") (open-rectangle . "o") (rectangle-backward-char . "b") (rectangle-backward-char . ,(kbd "C-b")) (rectangle-exchange-point-and-mark . "x") (rectangle-exchange-point-and-mark . ,(kbd "C-x C-x")) (rectangle-forward-char . "f") (rectangle-forward-char . ,(kbd "C-f")) (rectangle-left-char . ,(kbd "")) (rectangle-mark-mode . " ") (rectangle-mark-mode . ,(kbd "C-x SPC")) (rectangle-next-line . ,(kbd "")) (rectangle-next-line . ,(kbd "C-n")) (rectangle-number-lines . "N") (rectangle-previous-line . ,(kbd "")) (rectangle-previous-line . ,(kbd "C-p")) (rectangle-right-char . ,(kbd "")) (string-rectangle . "t") (yank-rectangle . "y") ) do (define-key rectangle-repeat-map key-sequence cmd) (put cmd 'repeat-map 'rectangle-repeat-map))) ---------------------------------------------------------------- In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-04-07 built on debian Repository revision: c1173f231d46f14f71886fa343dbc7501f064919 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12010000 System Description: Debian GNU/Linux bullseye/sid Configured using: 'configure -with-imagemagick --with-json --with-xwidgets'