From: Jim Porter <jporterbugs@gmail.com>
To: emacs-devel@gnu.org
Subject: [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map
Date: Fri, 30 Apr 2021 22:23:48 -0700 [thread overview]
Message-ID: <CANh=_JGvAwAjerBukCrJB9Je2gzZ4F7kO4iOWS92u54w67rc4g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]
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'. The
attached patch adds these (remapped from `kill-region' and
`kill-ring-save'), but there are still several other rectangle
commands in the `C-x r' prefix that might be worth adding, so I
figured I'd see what others thought:
C-x r N rectangle-number-lines
C-x r c clear-rectangle
C-x r d delete-rectangle
C-x r r copy-rectangle-to-register
As far as I'm aware, none of these have non-rect analogues that we
could remap except for `C-x r r', which is similar to `C-x r s'
(`copy-to-register'). Perhaps it makes sense to map these as well, but
I don't typically use any of them so I'm not sure what would be good
mappings. At a guess though, maybe these would work?
M-N (M-S-n) rectangle-number-lines
M-SPC clear-rectangle
C-d delete-rectangle
C-x r s copy-rectangle-to-register
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.
- Jim
[-- Attachment #2: 0001-lisp-rect.el-rectangle-mark-mode-map-Add-kill-rectan.patch --]
[-- Type: application/octet-stream, Size: 953 bytes --]
From d10cf1dc7f459588a905134f84b76c6948f3cace Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Fri, 30 Apr 2021 21:47:29 -0700
Subject: [PATCH] * lisp/rect.el (rectangle-mark-mode-map): Add
`kill-rectangle' and `copy-rectangle-as-kill' to map
---
lisp/rect.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/rect.el b/lisp/rect.el
index 504be41b67..bae9142129 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -638,6 +638,8 @@ with a prefix argument, prompt for START-AT and FORMAT."
(let ((map (make-sparse-keymap)))
(define-key map [?\C-o] 'open-rectangle)
(define-key map [?\C-t] 'string-rectangle)
+ (define-key map [remap kill-region] 'kill-rectangle)
+ (define-key map [remap kill-ring-save] 'copy-rectangle-as-kill)
(define-key map [remap exchange-point-and-mark]
'rectangle-exchange-point-and-mark)
(dolist (cmd '(right-char left-char forward-char backward-char
--
2.25.1
next reply other threads:[~2021-05-01 5:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 5:23 Jim Porter [this message]
2021-05-01 13:29 ` [WIP PATCH] Adding more keybindings to rectangle-mark-mode-map Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANh=_JGvAwAjerBukCrJB9Je2gzZ4F7kO4iOWS92u54w67rc4g@mail.gmail.com' \
--to=jporterbugs@gmail.com \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.