Subject: bug#35257: eshell and xclip

From: Noam Postavsky <[email-masked]>
Date: Sun, 14 Apr 2019 09:54:07 -0400

Daniel Sockwell <[email-masked]> writes:

> I recently ran into a minor issue, however.  I discovered that xclip
> does not seem to work at all in eshell: the same commands that work fine
> in a term buffer (or in external terminal emulators) have no effect in
> eshell.  Further, the command does not provide an error message, it just
> fails to set the system clipboard.

> (This is my first time submitting an Emacs bug, but I am sure it won't be my
> last—I plan to get more involved in the project soon.  Please let me know if
> should do anything differently in future bug reports or if I can provide any
> other information about this bug/help in any other way.  Thanks so much!)

It would help to have a precise recipe starting from 'emacs -Q' to
reproduce the problem.  In this case I'm guessing it should be like
this:

emacs -Q -f eshell

    Welcome to the Emacs shell

    ~ $ echo foo | xclip -i
    ~ $ xclip -o
    Error: target STRING not available

And in comparison the expected output with shell:

emacs -Q -f shell

    $ echo foo | xclip -i
    $ xclip -o
    foo

With eshell bugs, it's often a good idea to reproduce the issue with
some plain lisp calls (if possible).  The simplest way to call external
processes from Emacs is with call-process:

    (progn (with-temp-file "/tmp/foo"
             (insert "foo"))
           (call-process "xclip" "/tmp/foo" '(t t) t "-i"))

But that just hangs until C-g.  So I'm really not sure what's going on
(is this a different bug, or the same one?).  Maybe debugging on the
xclip side is needed.