Hi. Yes, I just tried your changes and it looks to be working fine now. On the other hand it looks like there is a bug or undocumented/unclear feature in the process-file function. A special comment should be added in all the external process call functions to clarify whats the expected behaviour in tramp mode. Does it makes sense? On 11 March 2019 21:16:00 CET, Stefan Monnier wrote: >Ergus writes: > >> Hi: >> >> There is an issue in xclip-mode when using tramp >> >> emacs -q -nw >> C-x C-f /ssh:user@host:file RET >> M-x load-file RET xclip.el RET >> M-x xclip-mode RET >> abcd C-SPC C-a M-w C-e RET <-1 >> C-y <-2 >> RET <-3 >> C-y M-y RET <-4 >> S-C-v <-5 >> >> Produces this output: >> abcd <-1 >> sh: xclip: command not found <-2 > >Duh! I pushed the patch below which seems to fix it for me. > >> abcd <-4 >> abcd <-5 >> >> As you can see the 2) yanks the error message including a new line. >> But 4) (emacs yank + yank-pop) yanks the text and 5 (xterm-paste) >too. > >I think these were side-effects of the previous problem. >xclip-1.8 (to appear soonish) will include this fix. > > Stefan > > >diff --git a/packages/xclip/xclip.el b/packages/xclip/xclip.el >index b142475b5..b1686e14d 100644 >--- a/packages/xclip/xclip.el >+++ b/packages/xclip/xclip.el >@@ -1,6 +1,6 @@ >;;; xclip.el --- Copy&paste GUI clipboard from text terminal -*- >lexical-binding:t -*- > >-;; Copyright (C) 2007, 2012, 2013, 2017, 2018 Free Software >Foundation, Inc. >+;; Copyright (C) 2007-2019 Free Software Foundation, Inc. > > ;; Author: Leo Liu > ;; Keywords: convenience, tools >@@ -144,21 +144,21 @@ See also `x-set-selection'." > (pcase xclip-method > (`pbpaste > (when (memq type '(clipboard CLIPBOARD)) >- (process-file xclip-program nil standard-output nil >+ (call-process xclip-program nil standard-output nil > "-Prefer" "txt"))) > (`getclip > (when (memq type '(clipboard CLIPBOARD)) >- (process-file xclip-program nil standard-output nil))) >+ (call-process xclip-program nil standard-output nil))) > (`xclip > (when (getenv "DISPLAY") >- (process-file xclip-program nil standard-output nil >+ (call-process xclip-program nil standard-output nil > "-o" "-selection" (symbol-name type)))) > (`xsel > (when (and (getenv "DISPLAY") > (memq type '(clipboard CLIPBOARD > primary PRIMARY > secondary SECONDARY))) >- (process-file xclip-program nil standard-output nil >+ (call-process xclip-program nil standard-output nil > "-o" (concat "--" (downcase (symbol-name type)))))) > (method (error "Unknown `xclip-method': %S" method)))))) > >@@ -281,7 +281,7 @@ Emacs-NN and is then later run by Emacs>NN." > (or clip-text > (when (and (memq xclip-method '(xsel xclip)) (getenv "DISPLAY")) > (let ((primary-text (with-output-to-string >- (process-file xclip-program nil >+ (call-process xclip-program nil > standard-output nil "-o")))) > (setq primary-text > (cond ; Check primary selection.