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?