old emacs user
old emacs user

Reputation: 1

Emacs yank behavior changed - how to get old behavior back?

This is on Linux (Ubuntu), working with emacs -nw in an xterm. GNU Emacs 26.3

Until recently I had two copy & paste mechanisms available:

  1. kill some text using ^K (kill-line), it would go to the kill-ring, and could be retrieved using ^Y (yank)

  2. select some text, possibly in another window, maybe in emacs or firefox, using the left mouse button, it would go to some X selection buffer, and could be retrieved using the middle mouse button.

These two channels worked entirely independent of each other.

Nowadays pasting a mouse selection pollutes the emacs kill-ring, or at least after mouse-pasting some text a yank also pastes that same text.

How can I teach emacs again not to change the kill-ring and use the unchanged kill-ring upon yank, independent of any mouse pasting? I tried a few combinations of (setq select-enable-clipboard t) and (setq select-enable-primary nil) but did not hit a successful .emacs incantation.

Upvotes: 0

Views: 281

Answers (1)

jpkotta
jpkotta

Reputation: 9437

Try

(setq interprogram-paste-function (lambda () nil))

If you've added something to the X11 clipboard, yank will try to insert that instead of the top of the kill ring using interprogram-paste-function. If i-p-f returns nil, it will use the top of kill-ring.

When I run a terminal Emacs, gui-selection-value always returns nil anyway, so I'm not sure why yours doesn't.


Looking at the source, (setq select-enable-clipboard nil select-enable-primary nil) should achieve the same result.

Upvotes: 0

Related Questions