bug#35257: eshell and xclip

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#35257: eshell and xclip

Daniel Sockwell
Thanks for all the great work on eshell!  I'm a big fan and using it as my
daily shell.

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!)

Best regards,
Daniel Sockwell


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.7)
 of 2019-03-17 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Antergos Linux

Recent messages:
Invoking man xclip in the background
xclip man page formatted
funcall-interactively: Text is read-only
user-error: No window right from selected window [2 times]
History item: 531
History item: 530
History item: 529
Mark set
History item: 532
evil-forward-char: End of line

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LC_COLLATE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Eshell

Minor modes in effect:
  diff-auto-refine-mode: t
  esh-autosuggest-mode: t
  global-fish-completion-mode: t
  fish-completion-mode: t
  global-evil-tabs-mode: t
  evil-tabs-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  which-key-mode: t
  minibuffer-line-mode: t
  winner-mode: t
  show-smartparens-global-mode: t
  smartparens-global-mode: t
  ivy-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  global-flycheck-mode: t
  global-company-mode: t
  company-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort emacsbug sendmail tabify misearch multi-isearch mhtml-mode
css-mode eww mm-url gnus nnheader url-queue url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
smartparens-javascript js cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs smartparens-html sgml-mode
woman dabbrev tramp tramp-compat tramp-loaddefs trampver ucs-normalize
parse-time lsp-ui lsp-ui-flycheck lsp-ui-doc smartparens-markdown
markdown-mode noutline outline goto-addr lsp-ui-imenu lsp-ui-peek
lsp-ui-sideline helpful trace edebug info-look shut-up help-fns
radix-tree elisp-refs loop cua-base cl-print debug mail-extr message
format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader move-text eterm-256color pollen-mode perl-mode pp vc-git
diff-mode smartparens-racket racket-mode racket-bug-report
racket-collection tq racket-stepper racket-logger racket-profile
racket-imenu racket-edit hideshow racket-complete shr svg xml dom
browse-url racket-repl ido racket-common racket-indent racket-font-lock
racket-util racket-ppss racket-keywords-and-builtins racket-custom
sh-script smie executable esh-autosuggest jka-compr xterm-color em-term
em-script em-prompt em-ls em-hist em-pred em-basic em-banner em-alias
two-column iso-transl server evil-smartparens elec-pair company-oddmuse
company-keywords company-etags etags company-gtags company-dabbrev-code
company-dabbrev company-files company-capf company-cmake company-xcode
company-clang company-semantic company-eclim company-template
company-bbdb fish-completion em-cmpl eshell-z em-dirs eshell-up em-smart
esh-help man em-unix esh-var esh-io esh-cmd esh-opt esh-ext esh-proc
esh-groups eshell esh-module esh-mode esh-arg projectile grep ibuf-ext
ibuffer ibuffer-loaddefs prettier-js evil-tabs elscreen dired
dired-loaddefs keyfreq which-key minibuffer-line multi-term cl term
disp-table ehelp nordless-theme winner time-date diminish
smartparens-config smartparens-text smartparens ivy delsel colir color
ivy-overlay ffap evil-surround evil evil-keybindings evil-integration
undo-tree diff evil-maps evil-commands reveal flyspell ispell evil-jumps
evil-command-window evil-types evil-search evil-ex shell pcomplete
evil-macros evil-repeat evil-states evil-core advice evil-common
windmove rect evil-digraphs evil-vars flycheck find-func rx company-lsp
lsp-mode tree-widget wid-edit xref url-util subr-x spinner
network-stream puny nsm rmc starttls tls gnutls json map inline imenu ht
filenotify f s em-glob esh-util dash-functional dash flymake-proc
flymake compile comint ansi-color ring warnings thingatpt project
company edmacro kmacro pcase cl-extra help-mode general use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core finder-inf
info package easymenu epg-config url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars
seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1054070 132875)
 (symbols 48 63615 2)
 (miscs 40 4214 3732)
 (strings 32 177644 18927)
 (string-bytes 1 4767174)
 (vectors 16 91339)
 (vector-slots 8 2231815 84710)
 (floats 8 439 1310)
 (intervals 56 55627 7620)
 (buffers 992 56))









Reply | Threaded
Open this post in threaded view
|

bug#35257: eshell and xclip

Noam Postavsky
Daniel Sockwell <[hidden email]> 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.



Reply | Threaded
Open this post in threaded view
|

bug#35257: eshell and xclip

Andreas Schwab-2
On Apr 14 2019, Noam Postavsky <[hidden email]> wrote:

> 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.

This is because xclip forks a background process that holds the
selection.  With eshell, that background process is killed immediately
(due to its lack of job control), so the selection is lost.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



Reply | Threaded
Open this post in threaded view
|

bug#35257: eshell and xclip

Noam Postavsky
tags 35257 + patch
quit

Andreas Schwab <[hidden email]> writes:

> This is because xclip forks a background process that holds the
> selection.  With eshell, that background process is killed immediately
> (due to its lack of job control), so the selection is lost.

Ah thanks, looks adding it to eshell-needs-pipe works.  This should be
safe enough for emacs-26.


From dfed83d8c87ec30560fea7daca5c7abfe76baf0b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[hidden email]>
Date: Mon, 15 Apr 2019 20:38:15 -0400
Subject: [PATCH] Tell xclip not to expect job-control (Bug#35257)

* lisp/eshell/esh-proc.el (eshell-needs-pipe): Add "xclip".
---
 lisp/eshell/esh-proc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 33ec19ae36..a4078e781d 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -242,7 +242,7 @@ (defvar eshell-last-sync-output-start nil
   "A marker that tracks the beginning of output of the last subprocess.
 Used only on systems which do not support async subprocesses.")
 
-(defvar eshell-needs-pipe '("bc")
+(defvar eshell-needs-pipe '("bc" "xclip")
   "List of commands which need `process-connection-type' to be nil.
 Currently only affects commands in pipelines, and not those at
 the front.  If an element contains a directory part it must match
--
2.11.0

Reply | Threaded
Open this post in threaded view
|

bug#35257: eshell and xclip

Noam Postavsky
tags 35257 fixed
close 35257 26.3
quit

> Andreas Schwab <[hidden email]> writes:
>
>> This is because xclip forks a background process that holds the
>> selection.  With eshell, that background process is killed immediately
>> (due to its lack of job control), so the selection is lost.
>
> Ah thanks, looks adding it to eshell-needs-pipe works.

Pushed to emacs-26, along with some more program names found in xclip.el
of GNU ELPA.

95bd56df88 2019-04-19T15:19:10-04:00 "Tell xclip not to expect job-control under eshell (Bug#35257)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=95bd56df883478bc16e25d7fc5e5d25a56278b7c