[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : mark multi regions, kill and yank
From: |
Uwe Brauer |
Subject: |
Re: [External] : mark multi regions, kill and yank |
Date: |
Mon, 30 Oct 2023 18:54:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "DA" == Drew Adams <drew.adams@oracle.com> writes:
>> I am looking for a package that allows me
>> 1. to mark several regions,
>> 2. To kill them
>> 3. And then later to yank everything.
> `C-w' kills the region text.
> `C-M-w' appends the region text to the last kill.
> So just use `C-w' for one region, then
> `C-M-w C-w' for each subsequent region you
> want to kill. Each `C-M-w C-w' appends that
> region to the latest string in `kill-ring'.
> Then `C-y' yanks them all, as the latest string
> in `kill-ring'.
> ___
I know, but this is not very visual, I really like to have the different
region marked before I start any action. The multi-region looks very
much what I need, but the kill operation only works for one marked
region and append-next-kill does not work with this package (which is
very old, it is a miracle that it somehow still works, well it is Emacs
of course)
> If you don't want to kill the regions, and you
> just want to copy them together (concatenated)
> to the kill-ring, you can use library zones.el
> for that. And it doesn't matter when you "mark"
> the regions of text that you want to later yank
> together.
> By default, each time you narrow the buffer,
> the buffer restriction (the "narrowing") is
> added to a list of zones, which is the value of
> a variable (`zz-izones', by default).
> You can prevent this automatic adding of
> narrowings as zones, by setting option
> `zz-narrowing-adds-zones-flag' to nil.
Ok thanks for pointint that out I will have look and for sure use the
function you provided below
> You can instead explicitly add the active
> region of text as a zone using `C-x n a'
> (command `zz-add-zone'). So just use that
> any time you want to record a zone.
> This is like `M-w', but instead of adding the
> region's text to the kill-ring it adds it to
> the current izones variable as a zone.
> It's easy to define a command that copies the
> text of the zones together to the `kill-ring':
> (defun zz-copy-izones-as-kill (&optional variable)
> "Copy text in izones to kill-ring.
> The zones to use are those of VARIABLE that are in the current buffer.
> VARIABLE defaults to the value of `zz-izones-var'. With a prefix arg
> you are prompted for a different variable to use."
> (interactive
> (list (or (and current-prefix-arg
> (zz-read-any-variable
> "Variable: " zz-izones-var t))
> zz-izones-var)))
> (let* ((var (or variable zz-izones-var))
> (izones (symbol-value var))
> (strings ()))
> (dolist (iz izones)
> (push (buffer-substring (cadr iz) (caddr iz)) strings))
> (kill-new (apply #'concat strings))))
> You can alternatively use a noncontiguous region.
> `zones.el' has functions for converting a set of
> zones to and from a noncontiguous region. (For
> one thing, this gives you an easy way to construct
> a noncontiguous region of any sort interactively.)
--
Warning: Content may be disturbing to some audiences
I strongly condemn Hamas terroristic attack on Israel, especially the
despicable pogroms.
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the NATO membership of Ukraine.
I support the EU membership of Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
smime.p7s
Description: S/MIME cryptographic signature
- mark multi regions, kill and yank, Uwe Brauer, 2023/10/30
- Re: mark multi regions, kill and yank, Bob Newell, 2023/10/30
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/30
- Re: [External] : mark multi regions, kill and yank,
Uwe Brauer <=
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/30
- Re: [External] : mark multi regions, kill and yank, Uwe Brauer, 2023/10/30
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/30
- Re: [External] : mark multi regions, kill and yank, Uwe Brauer, 2023/10/31
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/31
- Re: [External] : mark multi regions, kill and yank, Uwe Brauer, 2023/10/31
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/31
- Re: [External] : mark multi regions, kill and yank, Uwe Brauer, 2023/10/31
- RE: [External] : mark multi regions, kill and yank, Drew Adams, 2023/10/31