From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map Date: Sat, 1 May 2021 09:02:51 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21810"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 01 18:05:32 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 1lcs7X-0005X7-Fd for ged-emacs-devel@m.gmane-mx.org; Sat, 01 May 2021 18:05:31 +0200 Original-Received: from localhost ([::1]:49244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcs7W-0001SY-IJ for ged-emacs-devel@m.gmane-mx.org; Sat, 01 May 2021 12:05:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcs59-00081D-Oi for emacs-devel@gnu.org; Sat, 01 May 2021 12:03:03 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:40680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcs57-0007wL-Q9 for emacs-devel@gnu.org; Sat, 01 May 2021 12:03:03 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id n16so461762plf.7 for ; Sat, 01 May 2021 09:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ihaWvkG91yvpQv7TfTXq9GluXPdgME4qB2Bz3SFoNjk=; b=YCgtGDGAsyXVecLjrmExvI9p72N90eFzqQT3AgRB7kYD0WKGD3KWfaRNGGq0Hg/ewJ p9CTp1evHozGHNQeWL8J/yNbek73qXYIH4TKh87h+3j9Zr77pPgl3Ev7HghndhQ/KYWm nX9FBI3Vvbn+5IK3a1NAJ9xE0bkqf4dWovq55rOdN6jhqNYo74dsvopn2fMKAItLfPVO MlmFIteMavK41HSv0lHKgAi//Xvb6S8dq408jdDMuaYF4YLz/58Ykmk1elyKQtTj6QPT HG76n2JwqF9RSeSMe/jKyTnBaeUrwqF50GHPTmKSq2gu4RMjNIAFmQGyOpbU9JbjWF3R ZVTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ihaWvkG91yvpQv7TfTXq9GluXPdgME4qB2Bz3SFoNjk=; b=H44asw8vcJoCX+4+fuf971WSgEptwfNINhCgCFk+j+75QSxRsQBFTwNsYHmcertQvO z/gxLAQ8ECV9IX/PjZrXMWsxh2WMP3flBfT9HOEqed/XJodON/PZlcMrcogHOxlEPhZn A8bFrgtB4k0ivNpP9CHViRIZotfz0TWgMV0aGqOBa1hNWiumeuMq9GjK1H6tlWTrlBJ8 InC2SuMeLTf34mxTL5im6Pg+gSitMT1v0ie7QZwxHHYQaYf7RfjfQekAKsnPrlclpBdg qqSRzB1ZUOJTV15BiirS+rLZD3nnlwVmkOYs9fvP/TOW21miSrTGS1JZiZ12O9XhSQXY CO5g== X-Gm-Message-State: AOAM533ch0Aa7uFNP6Zfgw6VmAiSVeVghOuvJV5UOxByQkLGSI1vt6F3 fdYDPW+x5BU5fHGPOTCGAaCWEqn0SJlybiWczgGwcj/H X-Google-Smtp-Source: ABdhPJzEw9uswMlVkhfSjfNigXCNn+efOKoxTcztsHUNPJtBpK7+KOD/1WNk/3DPCRyH4PUrb+zYOJpbmkZcY4qv/RE= X-Received: by 2002:a17:903:2c1:b029:eb:3000:2984 with SMTP id s1-20020a17090302c1b02900eb30002984mr11234996plk.15.1619884980286; Sat, 01 May 2021 09:03:00 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, 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:268721 Archived-At: On Sat, May 1, 2021 at 6:29 AM Stefan Monnier wrote: > > > 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'? Hmm, trying again without my patch, I see that you're right. I think I may have tripped myself up by assuming the conversion went from `C-x r k' to `C-k' in `rectangle-mark-mode', similarly to `C-o' and `C-t' in `rectangle-mark-mode'. Then when I looked at the key map for `rectangle-mark-mode', I didn't see any relevant mappings and incorrectly assumed I'd discovered the issue. Perhaps it makes sense to bind `C-k' in `rectangle-mark-mode'? It seems to be similar to `C-o' and `C-t' in that there are non-rect bindings that already do something different, but they aren't particularly relevant in `rectangle-mark-mode'. > > > 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`? That would be fine with me, although I'm not sure what (if any) keys we'd bind them to... > > 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. Interesting, I didn't know that! I'd tried `M-x delete-region' (and Edit -> Clear from the menu bar) and it deleted the whole, non-rectangular region. Perhaps that's just a bug, since `M-x kill-region' operates on the rect correctly. > 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. I agree. Once I tinkered with yanking rectangles a bit, it (mostly) made sense to me, but instinctively, I wanted to select the rect to yank into first. That works as you'd expect when the point is at the beginning of the rect but not when it's at the end. I'm not sure what I'd want to change though, since it works the same as yanking when you have a non-rectangular region selected too. - Jim