help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convert rectangle's lines to a flat string and put it in the kill ring


From: Teemu Likonen
Subject: Convert rectangle's lines to a flat string and put it in the kill ring
Date: Sun, 08 Sep 2013 15:39:59 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

I'm trying to write a custom rectangle copy command. It should convert
rectangle's lines to a flat string like this: "line1|line2|line3", that
is, use separator character "|" between lines. The resulting string
should be put in the kill ring so that the next yank command would
insert it.


    (defun tl-rectangle-string (beg end)
      (interactive "r")
      (let ((list (extract-rectangle beg end)))
        (kill-new (mapconcat 'substring-no-properties list "|"))
        (setq deactivate-mark t)))


It doesn't work. The next yank command inserts the region between BEG
and END, not the generated flat string. "yank + yank-pop" inserts the
generated string but I'd like to have it first in the yank list. Any
ideas?

Attachment: pgpTrZvjZqvnb.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]