unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : mark multi regions, kill and yank
Date: Mon, 30 Oct 2023 18:54:43 +0100	[thread overview]
Message-ID: <87il6ovvvg.fsf@mat.ucm.es> (raw)
In-Reply-To: SJ0PR10MB54887FCD2B2887AB90A941DAF3A1A@SJ0PR10MB5488.namprd10.prod.outlook.com

[-- Attachment #1: Type: text/plain, Size: 3455 bytes --]

>>> "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/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

  reply	other threads:[~2023-10-30 17:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 16:02 mark multi regions, kill and yank Uwe Brauer
2023-10-30 17:11 ` Bob Newell
2023-10-30 17:56   ` Uwe Brauer
2023-10-30 19:56     ` Bob Newell
2023-10-30 17:32 ` [External] : " Drew Adams
2023-10-30 17:54   ` Uwe Brauer [this message]
2023-10-30 19:39     ` Drew Adams
2023-10-30 20:32       ` Uwe Brauer
2023-10-30 21:42         ` Drew Adams
2023-10-31  8:53           ` Uwe Brauer
2023-10-31 16:39             ` Drew Adams
2023-10-31 16:52               ` Uwe Brauer
2023-10-31 17:48                 ` Drew Adams
2023-10-31 20:36                   ` Uwe Brauer
2023-10-31 21:08                     ` Drew Adams
2023-11-01  7:05                       ` Uwe Brauer
2023-11-01 15:00                         ` Drew Adams

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=87il6ovvvg.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=help-gnu-emacs@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.
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).