In Emacs 24 I used to have a workflow for inserting a string into multiple lines at once:

  1. Go to the desired position in the first line.
  2. Press C-Space to place the mark.
  3. Go to the last line (while remaning in the same column).
  4. Press C-x r t for the string-rectangle command.
  5. Input the desired string into the minibuffer by either
    1. typing it
    2. or pressing C-y (yank) to use the most recent kill.
  6. Finally hit Enter.

After upgrading from Emacs 24 to 25, I found that step 5.2 inserts what I just selected in steps 1 to 3: pressing C-x r t behaves as if I had pressed M-w (kill-ring-save) as well. As a result, I have to press and extra M-y (yank-pop) in step 5.2.

Is there any way to prevent the selection from getting pushed onto the kill ring when invoking string-rectangle?

Please note that I use Xorg, so the X clipboard also affects Emacs's kill ring. Additionally, I have a clipboard manager running (Diodon) that synchronizes the X clipboard and the X primary selection (which is basically the last text selected using the mouse). So the selection may end up on top of the kill ring through either the X clipboard or the X primary selection. Nonetheless, this didn't use to happen in Emacs 24 and I would not like it to happen in Emacs 25 either.

  • I can't reproduce this problem in emacs -Q using Emacs-25.1. My guess is this problem is triggered by something in your local configuration. – Stefan May 13 '18 at 2:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.