I use Emacs in the terminal (emacs -nw) and xclip.el for synchronising the kill ring with the X clipboard. Under normal circumstances this works fine, but when visiting buffers with tramp xclip is not able to set the X clipboard. I believe something is failing with the xclip shell command when run through tramp, but I don't know how to debug it.

Investigating so far I have found:

  • Yanking in a tramp buffer works fine and is able to yank from the kill ring or X clipboard.
  • Killing text under tramp causes the text to be added to the kill ring, but the X clipboard does not get set.
  • It doesn't matter which user or host is used to access files through tramp - I can visit files using /sudo:myusername@localhost:/... and the failure still occurs.
  • xclip processes don't get closed after killing text in a tramp process, which is what leads me to believe something is failing there. I see the text below when I close Emacs. (This does not occur when killing to xclip in a normal buffer).

Active processes exist; kill them and exit anyway? (yes or no)

Process [v]     Status  Buffer          TTY          Command                                   
xclip           run     --              /dev/pts/6   /bin/sh -i
xclip<1>        run     --              /dev/pts/7   /bin/sh -i

xclip.el uses start-file-process and process-send-string to run xclip, but I don't know how to debug these functions or see if there is any error output. There are no errors in the Messages buffer.

Is there something I can do to fix this problem or some way to debug what is going wrong with the xclip shell commands?

  • 1
    Could you try and replace start-file-process with start-process everywhere in xclip.el to see if it fixes it for you? In any case I suggest you file a bug report.
    – Stefan
    Commented Nov 14, 2018 at 13:03
  • @Stefan, Yes, this appears to solve the issue. I have sent a bug report to the email list. Commented Nov 15, 2018 at 9:42

1 Answer 1


Thanks to authors Stefan Monnier and Leo Liu this bug was fixed in xclip.el version 1.5.

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.