Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C-y doesn't yank in emacs under tmux

Tags:

emacs

tmux

Update

What's happening is that whenever I kill some text, it gets added to the kill-ring followed by an extra "". Then C-y just inserts the "". So the question is where is the extra "" coming from?

Original Question

I'm running emacs under tmux, and I can't get C-y (or even M-x yank) to insert content from the kill-ring. I do see Mark set in the minibuffer, which is normal behavior for yank; I just don't see anything getting yanked. I also see that "" gets added to the kill-ring each time I hit C-y.

I know that C-y is getting received by emacs by looking at the output of M-x view-lossage, and I know that C-y is bound to yank by looking at the keybindings with C-h b. Moreover, running M-x yank directly gives the exact same results.

When I repeat the experiment outside of tmux, it works as expected. For what it's worth, if I repeat the experiment with screen instead of tmux, C-y works as expected.

Some more details are that within tmux, I have tried running emacs with TERM=xterm-256color and TERM=screen-256color with the same result. Setting xterm-keys on or xterm-keys off in tmux doesn't seem to matter either. I've been closing every tmux session between each permutation I try, to make sure that my .tmux.conf is getting re-processed (And I know it is because other changes in my .tmux.conf do have an effect.) In fact, I can even comment out my entire .tmux.conf, with the same result.

Also, I've tried it in both iTerm2 and Terminal.app (I'm on a mac), again with the same result.

So, I feel like I am at a dead-end here. Any ideas on how to better debug this problem?

like image 899
speedarius Avatar asked Nov 10 '12 09:11

speedarius


1 Answers

I finally tracked it down to some code I had copied into my emacs init.el to allow copy-and-paste from my OSX clipboard. If I remove that code from my init.el, C-y works fine under tmux. (The code is here -- it worked great until I decided to try out tmux!) I'm still not sure exactly what the problem is, but it's easy to believe that it would affect the behavior of C-y.

like image 153
speedarius Avatar answered Sep 30 '22 00:09

speedarius