From: Drew Adams <drew.adams@oracle.com>
To: Skip Montanaro <skip.montanaro@gmail.com>,
Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: RE: TIL about string-rectangle
Date: Wed, 30 Dec 2020 13:43:32 -0800 (PST) [thread overview]
Message-ID: <448d5e17-910f-4d32-b99c-96410c8e802e@default> (raw)
In-Reply-To: <CANc-5Ux9tXhPFrDt+NX6YtCjHLOrkbAXixoRL6XzhBJLdqcXiQ@mail.gmail.com>
> Poking around for help from Emacs against a future need, I
> discovered replace-rectangle, which turns out to be an alias for
> string-rectangle (bound to C-x r t). It looks to be quite handy when
> you need to replace text within a rectangle. It's sort of (but not
> quite) like narrow-to-region + query-replace(-regexp)?. It doesn't
> query for a string to replace. It simply replaces the rectangle's
> contents with the given string on each line.
You can also use the usual replacement commands
in a rectangular region. `C-x SPC' to establish
the region, then `C-M-%' or whatever, to search
and replace only with that rectangular region.
___
And if you use library `isearch+.el' then you can
constrain Isearch to within just the region,
including a rectangular region.
https://www.emacswiki.org/emacs/IsearchPlus#isearchp-restrict-to-region-flag
https://www.emacswiki.org/emacs/download/isearch%2b.el
next prev parent reply other threads:[~2020-12-30 21:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-30 20:59 TIL about string-rectangle Skip Montanaro
2020-12-30 21:37 ` Tim Landscheidt
2020-12-30 22:11 ` Skip Montanaro
2020-12-31 8:03 ` Yuri Khan
2020-12-31 10:21 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-31 12:44 ` Skip Montanaro
2020-12-31 14:32 ` Tim Landscheidt
2020-12-30 21:43 ` Drew Adams [this message]
2020-12-30 22:08 ` Skip Montanaro
2020-12-30 23:11 ` Drew Adams
2020-12-30 23:23 ` Drew Adams
2020-12-30 23:24 ` Skip Montanaro
2020-12-31 7:15 ` Sivaram Neelakantan
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=448d5e17-910f-4d32-b99c-96410c8e802e@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=skip.montanaro@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.
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).