From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jim Porter <jporterbugs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map
Date: Sat, 01 May 2021 09:29:42 -0400 [thread overview]
Message-ID: <jwvh7jm61ou.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CANh=_JGvAwAjerBukCrJB9Je2gzZ4F7kO4iOWS92u54w67rc4g@mail.gmail.com> (Jim Porter's message of "Fri, 30 Apr 2021 22:23:48 -0700")
> 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
next prev parent reply other threads:[~2021-05-01 13:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 5:23 [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map Jim Porter
2021-05-01 13:29 ` Stefan Monnier [this message]
2021-05-01 16:02 ` Jim Porter
2021-05-01 17:20 ` Stefan Monnier
2021-05-01 22:31 ` Jim Porter
2021-05-02 6:57 ` Eli Zaretskii
2021-05-02 15:48 ` Jim Porter
2021-05-02 16:09 ` Eli Zaretskii
2021-05-02 16:36 ` Jim Porter
2021-05-02 18:07 ` Stefan Monnier
2021-05-03 4:06 ` Jim Porter
2021-05-03 7:55 ` Andreas Schwab
2021-05-03 15:26 ` Jim Porter
2021-05-08 1:52 ` Stefan Monnier
2021-05-08 7:15 ` Eli Zaretskii
2021-05-08 6:55 ` Andreas Schwab
2021-05-08 18:57 ` [PATCH] Improve docstring for delete-active-region (was Re: [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map) Jim Porter
2021-06-18 3:09 ` Jim Porter
2021-06-19 12:27 ` Lars Ingebrigtsen
2021-06-19 16:28 ` Jim Porter
2021-05-01 17:26 ` [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map Ergus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvh7jm61ou.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=jporterbugs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).