From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 15 09:19:59 2018 Received: (at submit) by debbugs.gnu.org; 15 Nov 2018 14:19:59 +0000 Received: from localhost ([127.0.0.1]:53131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gNIUw-0002VS-Lf for submit@debbugs.gnu.org; Thu, 15 Nov 2018 09:19:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gNE9s-0000AT-Lg for submit@debbugs.gnu.org; Thu, 15 Nov 2018 04:41:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNE9l-00049o-FE for submit@debbugs.gnu.org; Thu, 15 Nov 2018 04:41:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNE9l-00049j-5v for submit@debbugs.gnu.org; Thu, 15 Nov 2018 04:41:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNE9j-0006jW-HC for bug-gnu-emacs@gnu.org; Thu, 15 Nov 2018 04:41:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNE9h-000474-Ky for bug-gnu-emacs@gnu.org; Thu, 15 Nov 2018 04:41:47 -0500 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:40728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNE9f-00041a-MC for bug-gnu-emacs@gnu.org; Thu, 15 Nov 2018 04:41:45 -0500 Received: by mail-qk1-x741.google.com with SMTP id y16so30802935qki.7 for ; Thu, 15 Nov 2018 01:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=UR7xlwbLjEjcwzzq19jUmxs/vutSbVqODXa990d5DtA=; b=h8U0ZRZdfHvmUO1NfyX3UV52ko/an5jrODRaKa/EYEUsnkuHcs2PQza3M9vd1biAa0 xGvAtmjJC8hwiiDvH+lammei03UUPgrSvSYWg+znz2wG5wr6ORM51BUmWeGcY6c+Vjzb kYVBWJC37SNRVztYH0StOYeEoqWjSLBNaIMWJlxG1MkxEL2s/a4B6NxKWDz3M80saYIw qtXE6sswRxRnnAEIltC7ZF4pWwUinev89Tg0ZWp28jriHcxc6/gCyfhWluDs2XIHv8sm pP8q71GDQgFuJO9LuhSsokjXRR1hi8R9kRczZGcBlfWmcPOZxiE77DpjWQCMdN9d/6zj eG+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=UR7xlwbLjEjcwzzq19jUmxs/vutSbVqODXa990d5DtA=; b=p3tudOZ8w4SJv88T2tuz4b9yrcnF6Nv7N8ciWJIB1mSaDSqiEIYU/1dQgJAZ598rI9 Z0rgt3qDyJcJhzBj+ejyvmV4W1fl8LZW4xz5Uzhhh9rDjJ/bClkE5lzHj27t17QVi6Dz m1I1jP51hcLhbXyeJQ07w2M3Xypxfnk0oAQ60nF2VS5B02TjK6DE7m4nkDzs+dMiII/z FZQi99uX+X2yToxXj6FroHa6wvPDbSQNGdACpb4oXJEnGI2hilM67vGVd7V7Pe7an/tI y+PW4BsYsoR3wz0mW6y1HTM/S7V2njxxYCmVr7Ax4kSSsKtTOzpyPrcQAPES3g86pp/T LzWg== X-Gm-Message-State: AGRZ1gJZILjey6leGMlUID0yQPJLfRnZEjCjlAyv+2ni/sf4MuS9rjTW adrJr127BW+LtaxdkcFuqyrtKKHoCoJgg/xysQIvgsyG X-Google-Smtp-Source: AJdET5d4KRmsm1KC7BF0WXal7Mcm4lf+4LkOfWvwRewbPJZjw6zAkfJQgPSQUnQLntbECsz6xKUnUp8bYIC06YRY/6c= X-Received: by 2002:aed:3802:: with SMTP id j2mr5405238qte.146.1542274900011; Thu, 15 Nov 2018 01:41:40 -0800 (PST) MIME-Version: 1.0 From: Ian Mackinnon Date: Thu, 15 Nov 2018 10:41:28 +0100 Message-ID: Subject: 25.2; xclip fails to set X selection when using tramp To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="0000000000008fb2d4057ab0dba3" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 15 Nov 2018 09:19:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --0000000000008fb2d4057ab0dba3 Content-Type: text/plain; charset="UTF-8" When visiting a file with tramp and killing text with xclip-mode enabled, the text gets sent to the kill-ring but the X clipboard does not get set. Additionally, the xclip shell process does not close. Steps to reproduce: - Ensure xclip is installed (In the shell: `which xclip`) - Install xclip Emacs package - Set variables `x-select-enable-clipboard` and/or `x-select-enable-primary` to `t`. - Enable xclip (`M-x xclip-mode RET`) - Visit a file using tramp (eg. `/sudo:user@localhost:/tmp/tramp-file`) - Type some text - Select a region and kill it Expected behaviour - Selected text gets sent to the kill-ring and X clipboard or primary buffer (this can be verified in the shell with `xclip -o -selection primary` and/or `xclip -o -selection clipboard`. - xclip processes exit cleanly Observed behaviour - Selected text gets sent to the kill-ring, but not the X clipboard or primary buffers. - xclip processes do not terminate (user is warned that they are still running when exiting Emacs). - Further, yanking text at this point causes the contents of the X clipboard or primary buffer to be inserted at the tip of the kill-ring so that gets yanked instead of the killed text. Workarounds As suggested in Emacs StackExchange by user Stefan (https://emacs.stackexchange.com/q/45991/7189) replacing `start-file-process` with `start-process` in a copy of the xclip 1.4 source fixes this particular issue though whether this causes any unwanted side effects has not been extensively tested. -- In GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.23.2) of 2018-08-27, modified by Debian built on lgw01-amd64-037 System Description: Ubuntu 18.10 Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs-nDyT48/emacs-25.2+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LC_COLLATE: C value of $LC_MONETARY: en_GB.UTF-8 value of $LC_NUMERIC: en_GB.UTF-8 value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-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 line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Quit C-x C-g is undefined Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils term/xterm xterm time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev 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 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 89350 6746) (symbols 48 19877 0) (miscs 40 40 121) (strings 32 14378 4594) (string-bytes 1 411363) (vectors 16 9777) (vector-slots 8 385958 16769) (floats 8 166 359) (intervals 56 247 0) (buffers 976 18)) --0000000000008fb2d4057ab0dba3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
When visit= ing a file with tramp and killing text with xclip-mode
enable= d, the text gets sent to the kill-ring but the X clipboard does
n= ot get set. Additionally, the xclip shell process does not close.

Steps to reproduce:

-=C2=A0 =C2=A0= Ensure xclip is installed (In the shell: `which xclip`)
-=C2=A0 = =C2=A0Install xclip Emacs package
-=C2=A0 =C2=A0Set variables `x-= select-enable-clipboard` and/or `x-select-enable-primary` to `t`.
-=C2=A0 =C2=A0Enable xclip (`M-x xclip-mode RET`)
-=C2=A0 =C2=A0= Visit a file using tramp (eg. `/sudo:user@localhost:/tmp/tramp-file`)
=
-=C2=A0 =C2=A0Type some text
-=C2=A0 =C2=A0Select a region a= nd kill it

Expected behaviour

=
-=C2=A0 =C2=A0Selected text gets sent to the kill-ring and X clipboard= or primary
=C2=A0 =C2=A0 buffer (this can be verified in the she= ll with `xclip -o -selection primary` and/or
=C2=A0 =C2=A0 `xclip= -o -selection clipboard`.
-=C2=A0 =C2=A0xclip processes exit cle= anly

Observed behaviour

-= =C2=A0 =C2=A0Selected text gets sent to the kill-ring, but not the X clipbo= ard or
=C2=A0 =C2=A0 primary buffers.
-=C2=A0 =C2=A0xcl= ip processes do not terminate (user is warned that they are still
=C2=A0 =C2=A0 running when exiting Emacs).
-=C2=A0 =C2=A0Further= , yanking text at this point causes the contents of the X
=C2=A0 = =C2=A0 clipboard or primary buffer to be inserted at the tip of the
=C2=A0 =C2=A0 kill-ring so that gets yanked instead of the killed text.<= /div>

Workarounds

As suggested = in Emacs StackExchange by user Stefan
`start-file-process` with `start-process` in a co= py of the xclip 1.4
source fixes this particular issue though whe= ther this causes any
unwanted side effects has not been extensive= ly tested.

--

In GNU Emac= s 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.23.2)
=C2=A0of 2018= -08-27, modified by Debian built on lgw01-amd64-037
System Descri= ption: Ubuntu 18.10

Configured using:
=C2=A0'configure --build x86_64-li= nux-gnu --prefix=3D/usr
=C2=A0--sharedstatedir=3D/var/lib --libex= ecdir=3D/usr/lib
=C2=A0--localstatedir=3D/var/lib --infodir=3D/us= r/share/info
=C2=A0--mandir=3D/usr/share/man --with-pop=3Dyes
=C2=A0--enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/25.= 2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.2/site-lis= p:/usr/share/emacs/site-lisp
=C2=A0--with-sound=3Dalsa --without-= gconf --build x86_64-linux-gnu
=C2=A0--prefix=3D/usr --sharedstat= edir=3D/var/lib --libexecdir=3D/usr/lib
=C2=A0--localstatedir=3D/= var/lib --infodir=3D/usr/share/info
=C2=A0--mandir=3D/usr/share/m= an --with-pop=3Dyes
=C2=A0--enable-locallisppath=3D/etc/emacs:/us= r/local/share/emacs/25.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/sh= are/emacs/25.2/site-lisp:/usr/share/emacs/site-lisp
=C2=A0--with-= sound=3Dalsa --without-gconf --with-x=3Dyes --with-x-toolkit=3Dgtk3
=C2=A0--with-toolkit-scroll-bars 'CFLAGS=3D-g -O2
=C2=A0-f= debug-prefix-map=3D/build/emacs-nDyT48/emacs-25.2+1=3D. -fstack-protector-s= trong
=C2=A0-Wformat -Werror=3Dformat-security -Wall' 'CP= PFLAGS=3D-Wdate-time
=C2=A0-D_FORTIFY_SOURCE=3D2' 'LDFLAG= S=3D-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOU= ND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETY= PE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
=C2=A0 value of $LC_COLLATE:= C
=C2=A0 value of $LC_MONETARY: en_GB.UTF-8
=C2=A0 val= ue of $LC_NUMERIC: en_GB.UTF-8
=C2=A0 value of $LC_TIME: en_GB.UT= F-8
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0 value of = $XMODIFIERS: @im=3Dibus
=C2=A0 locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0= global-eldoc-mode: t
=C2=A0 electric-indent-mode: t
= =C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
= =C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t<= /div>
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode= : t
=C2=A0 transient-mark-mode: t

Recent= messages:
For information about GNU Emacs and the GNU system, ty= pe C-h C-a.
Quit
C-x C-g is undefined

Load-path shadows:
None found.

F= eatures:
(shadow sort mail-extr emacsbug message dired format-spe= c rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-d= ecode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils= mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns = help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils= term/xterm xterm
time-date mule-util tooltip eldoc electric uniq= uify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common= -win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated= -list newcomment elisp-mode lisp-mode
prog-mode register page men= u-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-loc= k syntax facemenu font-core frame cl-generic cham
georgian utf-8-= lang misc-lang vietnamese tibetan thai tai-viet lao
korean japane= se eucjp-ms cp51932 hebrew greek romanian slovak czech
european e= thiopic indian cyrillic chinese charscript case-table epa-hook
jk= a-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
lo= addefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hasht= able-print-readable backquote dbusbind inotify dynamic-setting
sy= stem-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory inf= ormation:
((conses 16 89350 6746)
=C2=A0(symbols 48 198= 77 0)
=C2=A0(miscs 40 40 121)
=C2=A0(strings 32 14378 4= 594)
=C2=A0(string-bytes 1 411363)
=C2=A0(vectors 16 97= 77)
=C2=A0(vector-slots 8 385958 16769)
=C2=A0(floats 8= 166 359)
=C2=A0(intervals 56 247 0)
=C2=A0(buffers 976= 18))


--0000000000008fb2d4057ab0dba3-- From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 15 13:37:49 2018 Received: (at 33399) by debbugs.gnu.org; 15 Nov 2018 18:37:49 +0000 Received: from localhost ([127.0.0.1]:54456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gNMWT-0002lP-E1 for submit@debbugs.gnu.org; Thu, 15 Nov 2018 13:37:49 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:57115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gNMWQ-0002lH-Ny for 33399@debbugs.gnu.org; Thu, 15 Nov 2018 13:37:47 -0500 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id wAFIbjLZ029984; Thu, 15 Nov 2018 13:37:45 -0500 Received: by pastel.home (Postfix, from userid 20848) id 6A69868235; Thu, 15 Nov 2018 13:37:45 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#33399: 25.2; xclip fails to set X selection when using tramp Message-ID: References: Date: Thu, 15 Nov 2018 13:37:45 -0500 In-Reply-To: (Ian Mackinnon's message of "Thu, 15 Nov 2018 10:41:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.3 X-NAI-Spam-Rules: 5 Rules triggered BODY_START_GREETING=0.1, COMMN_DTNG_TRAIT_RLE=0.1, TRK_NCM1=0.1, EDT_SA_DN_PASS=0, RV6419=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6419> : inlines <6959> : streams <1804360> : uri <2750167> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33399 Cc: Ian Mackinnon , 33399@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Leo, > As suggested in Emacs StackExchange by user Stefan > (https://emacs.stackexchange.com/q/45991/7189) replacing > `start-file-process` with `start-process` in a copy of the xclip 1.4 > source fixes this particular issue though whether this causes any > unwanted side effects has not been extensively tested. xclip.el uses start-file-processes everywhere nowadays, largely because of changes I introduced, but I only used it because the previous code used it, not because I thought it was needed. Tracking the origin of start-file-processes in xclip.el I see it was introduced by the following change: commit f160382d9dd3acb36f562e82993e07765411c354 Author: Leo Liu Date: Fri Sep 6 12:32:20 2013 +0800 * xclip.el: Use pbcopy and pbpaste if available (xclip-use-pbcopy&paste): New variable. (xclip-set-selection, xclip-selection-value, xclip-mode): Use it. [ I appended the corresponding diff after my sig for reference. ] Do you remember why you used start-file-processes there? Stefan diff --git a/packages/xclip/xclip.el b/packages/xclip/xclip.el index d08dcd255..bc9b64057 100644 --- a/packages/xclip/xclip.el +++ b/packages/xclip/xclip.el @@ -5,7 +5,7 @@ ;; Author: Leo Liu ;; Keywords: convenience, tools ;; Created: 2007-12-30 -;; Version: 1.1 +;; Version: 1.2 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -41,6 +41,15 @@ This is in addition to, but in preference to, the primary selection." :type 'boolean :group 'killing) +(defcustom xclip-use-pbcopy&paste (and xclip-select-enable-clipboard + (eq system-type 'darwin) + (executable-find "pbcopy") + t) + "Non-nil means using pbcopy and pbpaste instead of xclip. +If non-nil `xclip-program' is ignored." + :type 'boolean + :group 'killing) + (defvar xclip-last-selected-text-clipboard nil "The value of the CLIPBOARD X selection from xclip.") @@ -51,12 +60,17 @@ This is in addition to, but in preference to, the primary selection." "TYPE is a symbol: primary, secondary and clipboard. See also `x-set-selection'." - (when (getenv "DISPLAY") - (let* ((process-connection-type nil) - (proc (start-process "xclip" nil xclip-program - "-selection" (symbol-name type)))) + (let* ((process-connection-type nil) + (proc (cond + (xclip-use-pbcopy&paste + (start-file-process "pbcopy" nil "pbcopy")) + ((getenv "DISPLAY") + (start-file-process "xclip" nil xclip-program + "-selection" (symbol-name type)))))) + (when proc (process-send-string proc data) - (process-send-eof proc)))) + (process-send-eof proc)) + data)) (defun xclip-select-text (text) "See `x-select-text'." @@ -68,24 +82,28 @@ See also `x-set-selection'." (defun xclip-selection-value () "See `x-selection-value'." - (when (getenv "DISPLAY") - (let ((clip-text (when xclip-select-enable-clipboard - (with-output-to-string + (let ((clip-text (when xclip-select-enable-clipboard + (with-output-to-string + (cond + (xclip-use-pbcopy&paste + (process-file "pbpaste" nil standard-output nil)) + ((getenv "DISPLAY") (process-file xclip-program nil standard-output nil - "-o" "-selection" "clipboard"))))) - (setq clip-text - (cond ; Check clipboard selection. - ((or (not clip-text) (string= clip-text "")) - (setq xclip-last-selected-text-clipboard nil)) - ((eq clip-text xclip-last-selected-text-clipboard) - nil) - ((string= clip-text xclip-last-selected-text-clipboard) - ;; Record the newer string so subsequent calls can use - ;; the `eq' test. - (setq xclip-last-selected-text-clipboard clip-text) - nil) - (t (setq xclip-last-selected-text-clipboard clip-text)))) - (or clip-text + "-o" "-selection" "clipboard"))))))) + (setq clip-text + (cond ; Check clipboard selection. + ((or (not clip-text) (string= clip-text "")) + (setq xclip-last-selected-text-clipboard nil)) + ((eq clip-text xclip-last-selected-text-clipboard) + nil) + ((string= clip-text xclip-last-selected-text-clipboard) + ;; Record the newer string so subsequent calls can use the + ;; `eq' test. + (setq xclip-last-selected-text-clipboard clip-text) + nil) + (t (setq xclip-last-selected-text-clipboard clip-text)))) + (or clip-text + (when (getenv "DISPLAY") (let ((primary-text (with-output-to-string (process-file xclip-program nil standard-output nil "-o")))) @@ -113,9 +131,11 @@ See also `x-set-selection'." :global t (if xclip-mode (progn - (or (executable-find xclip-program) + (or xclip-use-pbcopy&paste + (executable-find xclip-program) (signal 'file-error (list "Searching for program" xclip-program "no such file"))) + ;; NOTE: See `tty-run-terminal-initialization' and term/README (add-hook 'terminal-init-xterm-hook 'turn-on-xclip)) (remove-hook 'terminal-init-xterm-hook 'turn-on-xclip))) From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 17 14:26:40 2018 Received: (at 33399) by debbugs.gnu.org; 17 Nov 2018 19:26:40 +0000 Received: from localhost ([127.0.0.1]:58149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gO6Eq-0003f0-78 for submit@debbugs.gnu.org; Sat, 17 Nov 2018 14:26:40 -0500 Received: from mail-pf1-f179.google.com ([209.85.210.179]:47038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gO6Eo-0003ej-SM for 33399@debbugs.gnu.org; Sat, 17 Nov 2018 14:26:39 -0500 Received: by mail-pf1-f179.google.com with SMTP id s9-v6so12929741pfm.13 for <33399@debbugs.gnu.org>; Sat, 17 Nov 2018 11:26:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version; bh=BndKxmiPFZa6k8JZiAamzlG4/bdhJNRUb0Z+JX2M0us=; b=fLs2kK1sNTa1VGncSzZ0R9Ntf0fosGqL/s6ONntRmI2YBk4n0sg0pkLbpKG7t0gj/K AMfJfxul8w3wvCQbhAo+p9nq9C/5nEOnDvx8RH70vZPT1XhIIUhjRISMqt8E6gevPHHN XDJS+9lmreDUME21uEU0yQ1kxxsFhpm2/mWdq6TMRehbDp6/332kLtMcc+1uzxjfyScx r8up1kpQITKL/DE7wUgfmoC8C6+LS8pnJqStmVqWtK/YIx5vlUtZRMMUWHPxX7nE2TcH qGWLUvdyK4qZYkUvz8B5STTlXFJQ6bdw6wLsMpwiy/vIhogkMvIFxdiFvZVZlrP7FnDB Z2Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:face:date :in-reply-to:message-id:user-agent:mime-version; bh=BndKxmiPFZa6k8JZiAamzlG4/bdhJNRUb0Z+JX2M0us=; b=pfKlcE/cuMjh/sxZdLog/q+2hju5dii3JfaMJ8Ci/OB2F5cnQJf0smFkAmhlwQim9V kh9r+YW6xm7VL6y5D/Ci/KlkRHwvskg/ddPh3tC3KGR8r6qIOMERx1jCSd3ioVM8QCfO gjt3TUaBZaUPicbh+7C1V7Zf6TAxI/2d6o9aqQDjSpAijZWDeQnKgwiQdkqOO4RkzpjG 1JqnWn8ygo98zcFWxGqhpdQQdu+e4uIapluSrPkG7O200HZug98z3SXpOAMYLwpAavUm 7X/Ynq89Qllho7K6R1jf0joCeXHYG/nUQIoG2kjLeOK2jVuvAjmYhjJu7jxdsQ9E1/md Y8nQ== X-Gm-Message-State: AGRZ1gLFwaJt9Ocjr8tkzvX9sodzRtvX6WTdTjQ5XrNP28HZhmyA0u3n /ZXumX7vZyCs2u+OLKvjeCXSId0P X-Google-Smtp-Source: AJdET5fPdcZURgwAv6t3RaBUBjiUYfFGmmhk8XYLWo2Koec5bE750CjFclSU8rZo6KM+TuROcUCKVA== X-Received: by 2002:a63:104d:: with SMTP id 13mr14550914pgq.303.1542482792776; Sat, 17 Nov 2018 11:26:32 -0800 (PST) Received: from Zeuss-MacBook-Air.local (174-081-033-050.dhcp.chtrptr.net. [174.81.33.50]) by smtp.gmail.com with ESMTPSA id b62-v6sm39593862pfa.159.2018.11.17.11.26.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Nov 2018 11:26:32 -0800 (PST) From: Leo Liu To: Stefan Monnier Subject: Re: bug#33399: 25.2; xclip fails to set X selection when using tramp References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Sat, 17 Nov 2018 11:26:28 -0800 In-Reply-To: (Stefan Monnier's message of "Thu, 15 Nov 2018 13:37:45 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (macOS 10.12.6) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33399 Cc: Ian Mackinnon , 33399@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi all, Sorry for the delay. On 2018-11-15 13:37 -0500, Stefan Monnier wrote: > Do you remember why you used start-file-processes there? > > > Stefan start-file-process looks like an odd choice and I can't remember why it was chosen. Feel free to change it. Leo From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 18 21:01:19 2018 Received: (at 33399-done) by debbugs.gnu.org; 19 Nov 2018 02:01:19 +0000 Received: from localhost ([127.0.0.1]:59531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOYsJ-0003xG-5X for submit@debbugs.gnu.org; Sun, 18 Nov 2018 21:01:19 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:47897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gOYsH-0003x8-7u for 33399-done@debbugs.gnu.org; Sun, 18 Nov 2018 21:01:18 -0500 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id wAJ21FPF017847; Sun, 18 Nov 2018 21:01:15 -0500 Received: by ceviche.home (Postfix, from userid 20848) id E457166132; Sun, 18 Nov 2018 21:01:14 -0500 (EST) From: Stefan Monnier To: Leo Liu Subject: Re: bug#33399: 25.2; xclip fails to set X selection when using tramp Message-ID: References: Date: Sun, 18 Nov 2018 21:01:14 -0500 In-Reply-To: (Leo Liu's message of "Sat, 17 Nov 2018 11:26:28 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.1 X-NAI-Spam-Rules: 3 Rules triggered GEN_SPAM_FEATRE=0.1, EDT_SA_DN_PASS=0, RV6420=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6420> : inlines <6961> : streams <1804676> : uri <2751951> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33399-done Cc: Ian Mackinnon , 33399-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > start-file-process looks like an odd choice and I can't remember why it > was chosen. Feel free to change it. OK, thanks. I just pushed a corresponding change. Should appear in v1.5 soon. Stefan From unknown Sun Jun 22 11:46:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 17 Dec 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator