From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.bugs Subject: bug#34798: 27.0.50; xclip issue in tramp mode Date: Tue, 12 Mar 2019 23:44:11 +0100 Message-ID: <686F9981-4105-4099-9FEC-E2A7E4C68021@aol.com> References: <20190309231128.vo3vraxbgpskpcot@Ergus> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----XRTM3VFQHF6UO6WGE3E2YLQOBTFGYU" Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="52484"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: K-9 Mail for Android Cc: 34798@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 12 23:45:21 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3q9A-000DVS-Dj for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Mar 2019 23:45:20 +0100 Original-Received: from localhost ([127.0.0.1]:34515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3q99-00043k-9v for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Mar 2019 18:45:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3q8w-00043T-Nn for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 18:45:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3q8u-0006bi-Qg for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 18:45:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55500) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3q8s-0006au-Om for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 18:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h3q8s-0007G5-EN for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2019 18:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Mar 2019 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34798 X-GNU-PR-Package: emacs Original-Received: via spool by 34798-submit@debbugs.gnu.org id=B34798.155243066627846 (code B ref 34798); Tue, 12 Mar 2019 22:45:02 +0000 Original-Received: (at 34798) by debbugs.gnu.org; 12 Mar 2019 22:44:26 +0000 Original-Received: from localhost ([127.0.0.1]:40811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3q8I-0007F3-0C for submit@debbugs.gnu.org; Tue, 12 Mar 2019 18:44:26 -0400 Original-Received: from sonic310-12.consmr.mail.ir2.yahoo.com ([77.238.177.33]:43570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3q8F-0007Ep-CR for 34798@debbugs.gnu.org; Tue, 12 Mar 2019 18:44:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1552430657; bh=KgxR/tbEccCao8pKDHWeEWB4lVVOs7oi8Fz2RiDdKR8=; h=Date:In-Reply-To:References:Subject:To:From:From:Subject; b=bv70PwuvgWjajHBu/cKdFR56nHjSXMLik/OvoysEcH8DrneF02Fl7C80OlXOyGPerZynzafjPjViBlwSFa0PPd3RqqOcjd1PbIGxqEdPtU+Gnv5tA+frA/VZTFpf10YV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Kqfz Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Tue, 12 Mar 2019 22:44:17 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO [192.168.1.3]) ([2.152.205.184]) by smtp412.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 53740f3ed9b7b3328b374a7bdebcd17c; Tue, 12 Mar 2019 22:44:16 +0000 (UTC) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156281 Archived-At: ------XRTM3VFQHF6UO6WGE3E2YLQOBTFGYU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi=2E Yes, I just tried your changes and it looks to be working fine now=2E On the other hand it looks like there is a bug or undocumented/unclear fea= ture in the process-file function=2E A special comment should be added in all the external process call functio= ns to clarify whats the expected behaviour in tramp mode=2E 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=2Eel 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=2E > >> abcd <-4 >> abcd <-5 >> >> As you can see the 2) yanks the error message including a new line=2E >> But 4) (emacs yank + yank-pop) yanks the text and 5 (xterm-paste) >too=2E > >I think these were side-effects of the previous problem=2E >xclip-1=2E8 (to appear soonish) will include this fix=2E > > Stefan > > >diff --git a/packages/xclip/xclip=2Eel b/packages/xclip/xclip=2Eel >index b142475b5=2E=2Eb1686e14d 100644 >--- a/packages/xclip/xclip=2Eel >+++ b/packages/xclip/xclip=2Eel >@@ -1,6 +1,6 @@ >;;; xclip=2Eel --- Copy&paste GUI clipboard from text terminal -*- >lexical-binding:t -*- >=20 >-;; Copyright (C) 2007, 2012, 2013, 2017, 2018 Free Software >Foundation, Inc=2E >+;; Copyright (C) 2007-2019 Free Software Foundation, Inc=2E >=20 > ;; Author: Leo Liu > ;; Keywords: convenience, tools >@@ -144,21 +144,21 @@ See also `x-set-selection'=2E" > (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)))))) >=20 >@@ -281,7 +281,7 @@ Emacs-NN and is then later run by Emacs>NN=2E" > (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=2E ------XRTM3VFQHF6UO6WGE3E2YLQOBTFGYU Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi=2E

Yes, I just tried your changes and it= looks to be working fine now=2E

On the other hand it looks like the= re is a bug or undocumented/unclear feature in the process-file function=2E=

A special comment should be added in all the external process call = functions to clarify whats the expected behaviour in tramp mode=2E

D= oes it makes sense?


On 11 March 2019 = 21:16:00 CET, Stefan Monnier <monnier@IRO=2EUMontreal=2ECA> wrote:
Ergus <spacibba@aol=2Ecom> 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=2Eel 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 outp= ut:
abcd <-1
sh: xclip: command not foun= d <-2

Duh! I pushed the patch below which seems to = fix it for me=2E

a= bcd <-4
abcd <-5<= br>
As you can see the 2) yanks the error message including a new line= =2E
But 4) (emacs yank + yank-pop) yanks the text and 5 (xterm-paste) t= oo=2E

I think these were side-effects of the previous p= roblem=2E
xclip-1=2E8 (to appear soonish) will include this fix=2E
Stefan


diff --git a/packages/xclip/xclip=2Eel b/packag= es/xclip/xclip=2Eel
index b142475b5=2E=2Eb1686e14d 100644
--- a/packa= ges/xclip/xclip=2Eel
+++ b/packages/xclip/xclip=2Eel
@@ -1,6 +1,6 @@<= br> ;;; xclip=2Eel --- Copy&paste GUI clipboard from text terminal -*-= lexical-binding:t -*-

-;; Copyright (C) 2007, 2012, 2013, 2017, 20= 18 Free Software Foundation, Inc=2E
+;; Copyright (C) 2007-2019 Free S= oftware Foundation, Inc=2E

;; Author: Leo Liu <sdl=2Eweb@gmail= =2Ecom>
;; Keywords: convenience, tools
@@ -144,21 +144,21 @@ See= also `x-set-selection'=2E"
(pcase xclip-method
(`pbp= aste
(when (memq type '(clipboard CLIPBOARD))
- (= process-file xclip-program nil standard-output nil
+ (call-pro= cess xclip-program nil standard-output nil
"-P= refer" "txt")))
(`getclip
(when (memq type '(clipb= oard CLIPBOARD))
- (process-file xclip-program nil standard-ou= tput nil)))
+ (call-process xclip-program nil standard-output = nil)))
(`xclip
(when (getenv "DISPLAY")
- = (process-file xclip-program nil standard-output nil
+ (ca= ll-process xclip-program nil standard-output nil
= "-o" "-selection" (symbol-name type))))
(`xsel
= (when (and (getenv "DISPLAY")
(memq type '(clipboar= d CLIPBOARD
primary PRIMARY
= secondary SECONDARY)))
- (process-f= ile xclip-program nil standard-output nil
+ (call-process xcli= p-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=2E"
(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 primar= y-text
(cond ; Check primary selectio= n=2E
------XRTM3VFQHF6UO6WGE3E2YLQOBTFGYU--