From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map Date: Sat, 01 May 2021 09:29:42 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8640"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 01 15:31:04 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lcpi4-00027D-Jn for ged-emacs-devel@m.gmane-mx.org; Sat, 01 May 2021 15:31:04 +0200 Original-Received: from localhost ([::1]:49428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcpi3-0004qt-Nq for ged-emacs-devel@m.gmane-mx.org; Sat, 01 May 2021 09:31:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcpgs-0004Ox-5q for emacs-devel@gnu.org; Sat, 01 May 2021 09:29:50 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5204) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcpgp-0005u1-TY for emacs-devel@gnu.org; Sat, 01 May 2021 09:29:49 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 93655100216; Sat, 1 May 2021 09:29:46 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 292161000C4; Sat, 1 May 2021 09:29:44 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1619875784; bh=cm5ue0ypwBeaoFkBqON7BiF5lqn8o+Nl5BvzTk4hmOs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=medfB2379pCvAHWpV6CGhNyWyHwtwuHtdTpKVnyfBYrDhFkXmLTqSw9gd/kyI/aqL FU28z/MjCcyG4ijmDeFMzYu5mS8Ct60kbaoA621No8KkHtB8hq66VfHkA4VX0mAf0g zMbN2PXHUUk7RwqlXcRXLHH1MOQCdFWEzySNg0/NpOZmxPADVY2dT5onfGw/QgwZIF lwMPGNGEvAPvoNw/GgftPRL+qZS5awSEcrQN+80VZRWQhdm0SuZJ6G40w10u/KZxPK RJwbP5T/zd50m+jJLYLi1kGTgtYA3H5pv3NNW/xwP6JIRk3WJqdtBU/HpO30R+cfN/ 7YKG2ZPqMGiWw== Original-Received: from alfajor (unknown [108.161.125.61]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BBC8E12045A; Sat, 1 May 2021 09:29:43 -0400 (EDT) In-Reply-To: (Jim Porter's message of "Fri, 30 Apr 2021 22:23:48 -0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268711 Archived-At: > One thing that always trips me up about the otherwise very nice > `rectangle-mark-mode-map' is that it only has a few key mappings, and > is notably missing `kill-rectangle' and `copy-rectangle-as-kill'. I don't understand: `kill-region` and `kill-ring-save` already operate on the rectangle when in `rectangle-mark-mode`, so why would you need keybindings for `kill-rectangle' and `copy-rectangle-as-kill'? > C-x r N rectangle-number-lines > C-x r c clear-rectangle [...] > > As far as I'm aware, none of these have non-rect analogues that we > could remap How 'bout we introduce analogues that operate on the region, and we make them work on the rectangle when in `rectangle-mark-mode`? > C-x r d delete-rectangle For `delete-rectangle` we already have `delete-region`, and it operates on the rectangle when `rectangle-mark-mode` is active. It is not bound by default, but DEL (aka `backspace`) does delegate to it by default when the region is active. > C-x r s copy-rectangle-to-register > except for `C-x r r', which is similar to `C-x r s' > (`copy-to-register'). Indeed `C-x r s` should already operate on the rectangle when in `rectangle-mark-mode`, so AFAIK there's nothing to do here. > Finally, there's `C-x r y' (`yank-rectangle'). As I understand it at > least, this doesn't need/want an active rect so there's no real reason > to map it in `rectangle-mark-mode-map'. However, when I was learning > about rects, I always *expected* `yank-rectangle' to require me to > have an active rect. Maybe it makes sense to do something about that, > or maybe not; that's just my anecdotal experience. In the current system, if you killed the rectangle with `C-w` (or `M-w`), then `C-y` will do the equivalent of `yank-rectangle`, so indeed you don't need `rectangle-mark-mode` to be active when yanking. This said, I do think the way yanking rectangles works currently is not fully satisfactory, because it's not always clear/intuitive how where the rectangle will get inserted. So maybe we do need a special yank command active during `rectangle-mark-mode` which replaces the selected rectangle with the yanked one, or something like that. Stefan