I updated to 25.1 and found that copy/paste works differently.

For example when I select a word "visit" and try to replace this word with [shift insert], text in clipboard is inserted in the beginning of the selection, instead of replacing it.

enter image description here

When I select visit and type text, visit is replaced as expected.

I have enabled delete selection and transient mark modes, it worked well in 24.5.

Do you know how to fix it?

  • Works for me on Emacs 25.1 started with emacs -q -nw in gnome-terminal on RHEL 7.
    – nispio
    Oct 4, 2016 at 15:07
  • From the sound of it, there might be a bug. Try to provide a step-by-step recipe, starting with emacs -Q, and send it to M-x report-emacs-bug. (If you cannot come up with such a recipe from emacs -Q then bisect your init file to find out what is causing the problem.)
    – Drew
    Oct 4, 2016 at 17:16
  • Thanks. I run CentOS 7.2. Has just deleted old emacs, support folder, and init file. Downloaded sources and made emacs from a scratch. Insert still does not replace text. Will try to report bug
    – Stepan S
    Oct 5, 2016 at 9:27

3 Answers 3


Finally I found a fix for the problem on emacswiki

(setq x-select-enable-primary t)
(setq select-enable-primary t)
(setq mouse-drag-copy-region t)

Quick tip: if you’re here looking to fix the fact that in Emacs shift-insert no longer pastes that text you highlighted with the mouse in your browser, the 2014 answer is to set x-select-enable-primary to true, and set mouse-drag-copy-region to true to go the other way - I can’t imagine why this excellent default was changed but it’s very hard to find the answer in the verbiage below.

But this works only for emacs installed from sources github/emacs-mirror, not 25.1

I also found that it depends on terminal. xterm fails, while vt100 works good


I had the same problem, and found (setq select-enable-primary t) makes the situation. I have sent it to M-x report-emacs-bug.

  • Setting select-enable-primary to nil fixes a problem for you?
    – Stepan S
    Nov 23, 2016 at 14:07
  • Yes, thank you! It seems that I placed the expression without understanding what select-enable-primary does. Dec 1, 2016 at 12:40

I just put (delete-selection-mode 1) in my .spacemacs file but I'm sure you can also put it in init.el

Source: https://www.emacswiki.org/emacs/DeleteSelectionMode

Then saved C-x C-s and reloaded/refreshed, on spacemacs that's SPC f e R there are many other ways to do it: https://stackoverflow.com/questions/2580650/how-can-i-reload-emacs-after-changing-it has a long and interesting (to me) discussion, I think M-: would be my favorite answer however it wasn't working for me so I went with my tried and true SPC f e R

Interesting fact: with this delete-selection-mode, to undo, takes 2 actions! I have to C-/ twice to get my original text back.

Very interesting: once you set (delete-selection-mode 1) if you just delete that line in the config and reload, the setting will still be there, you have to (delete-selection-mode 0) to recreate the original behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.