From unknown Mon Aug 18 15:39:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Sep 2011 16:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 9563@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.131653710926998 (code B ref -1); Tue, 20 Sep 2011 16:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Sep 2011 16:45:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R63RV-00071P-43 for submit@debbugs.gnu.org; Tue, 20 Sep 2011 12:45:09 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R63RP-00070z-Vq for submit@debbugs.gnu.org; Tue, 20 Sep 2011 12:45:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R63MR-0006QX-A6 for submit@debbugs.gnu.org; Tue, 20 Sep 2011 12:39:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:54005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R63MR-0006QT-6L for submit@debbugs.gnu.org; Tue, 20 Sep 2011 12:39:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R63MQ-0003zP-9w for bug-gnu-emacs@gnu.org; Tue, 20 Sep 2011 12:39:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R63MP-0006Q4-5F for bug-gnu-emacs@gnu.org; Tue, 20 Sep 2011 12:39:54 -0400 Received: from smarty.dreamhost.com ([208.113.175.8]:41732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R63MO-0006Py-QL for bug-gnu-emacs@gnu.org; Tue, 20 Sep 2011 12:39:53 -0400 Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 699536E8056 for ; Tue, 20 Sep 2011 09:39:52 -0700 (PDT) Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B0952451C1B8 for ; Tue, 20 Sep 2011 09:39:51 -0700 (PDT) From: Juri Linkov Organization: JURTA Date: Tue, 20 Sep 2011 19:20:30 +0300 Message-ID: <87y5xj89kv.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.6 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) The default behavior is dangerous now on GNU/Linux, it may delete random files. Steps to reproduce the problem: 1. emacs -Q 2. Open a shell script, mark a multi-line region with a few commands and copy it with `M-w'. 3. Forget it. 4. Open a Dired buffer. 5. Copy a file name with `M-0 w'. 6. Open xterm. 7. Paste the copied file name with `S-Insert'. Instead of pasting the copied file name it starts executing random commands, i.e. if text copied at step 2 contains newlines, it's submitted for execution to the shell. The problem is that `M-w' puts copied text to the primary selection while `M-0 w' in Dired does not. I think `dired-copy-filename-as-kill' should do the same as `deactivate-mark' does with (x-set-selection 'PRIMARY ...) From unknown Mon Aug 18 15:39:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Jul 2012 01:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Juri Linkov Cc: 9563@debbugs.gnu.org Received: via spool by 9563-submit@debbugs.gnu.org id=B9563.13422309528688 (code B ref 9563); Sat, 14 Jul 2012 01:56:01 +0000 Received: (at 9563) by debbugs.gnu.org; 14 Jul 2012 01:55:52 +0000 Received: from localhost ([127.0.0.1]:39976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SpraK-0002G4-3x for submit@debbugs.gnu.org; Fri, 13 Jul 2012 21:55:52 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:52830) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SpraH-0002Fw-Rf for 9563@debbugs.gnu.org; Fri, 13 Jul 2012 21:55:50 -0400 Received: from cm162.gamma80.maxonline.com.sg ([202.156.80.162]:60073 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SprUl-0003cH-S7; Fri, 13 Jul 2012 21:50:08 -0400 From: Chong Yidong References: <87y5xj89kv.fsf@mail.jurta.org> Date: Sat, 14 Jul 2012 09:50:02 +0800 In-Reply-To: <87y5xj89kv.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 20 Sep 2011 19:20:30 +0300") Message-ID: <87liin2jsl.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Juri Linkov writes: > 1. emacs -Q > 2. Open a shell script, mark a multi-line region with a few commands > and copy it with `M-w'. > 3. Forget it. > 4. Open a Dired buffer. > 5. Copy a file name with `M-0 w'. > 6. Open xterm. > 7. Paste the copied file name with `S-Insert'. > > Instead of pasting the copied file name it starts executing random > commands, i.e. if text copied at step 2 contains newlines, it's > submitted for execution to the shell. > > I think `dired-copy-filename-as-kill' should do the same as > `deactivate-mark' does with (x-set-selection 'PRIMARY ...) Hmm, I don't think this is a real issue. You can come up with similar scenarios in other applications. - Select some text in one Firefox window - In another Firefox window, click and drag some text with the mouse (so it's now on the primary selection) - Re-select the first window and type Control-c - Click mouse-2 to in an xterm => the text from the second window (which still holds the primary selection) gets pasted Granted, Emacs has more ways to "silently" put things on the clipboard or primary selection, i.e. without having to drag the mouse first. But I think it is overstepping the bounds of expectation for us to clobber the primary selection while putting text in the clipboard, just to prevent the user from doing something that might or might not be an error (e.g. the user may really want to paste the primary selection). From unknown Mon Aug 18 15:39:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Jul 2012 09:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: 9563@debbugs.gnu.org Received: via spool by 9563-submit@debbugs.gnu.org id=B9563.134225950330298 (code B ref 9563); Sat, 14 Jul 2012 09:52:02 +0000 Received: (at 9563) by debbugs.gnu.org; 14 Jul 2012 09:51:43 +0000 Received: from localhost ([127.0.0.1]:40292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Spz0p-0007sd-4a for submit@debbugs.gnu.org; Sat, 14 Jul 2012 05:51:43 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:51006 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Spz0n-0007sV-9G for 9563@debbugs.gnu.org; Sat, 14 Jul 2012 05:51:42 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3C70C451CB44; Sat, 14 Jul 2012 02:45:57 -0700 (PDT) From: Juri Linkov Organization: JURTA References: <87y5xj89kv.fsf@mail.jurta.org> <87liin2jsl.fsf@gnu.org> Date: Sat, 14 Jul 2012 12:37:10 +0300 In-Reply-To: <87liin2jsl.fsf@gnu.org> (Chong Yidong's message of "Sat, 14 Jul 2012 09:50:02 +0800") Message-ID: <87a9z28zas.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Granted, Emacs has more ways to "silently" put things on the clipboard > or primary selection, i.e. without having to drag the mouse first. But > I think it is overstepping the bounds of expectation for us to clobber > the primary selection while putting text in the clipboard, just to > prevent the user from doing something that might or might not be an > error (e.g. the user may really want to paste the primary selection). Yes, there are more ways to screw up things. For instance, C-k puts text only on the clipboard that can't be pasted to xterm, etc. So e.g. typing C-k in Emacs on X can't yank that text with C-y in another Emacs instance in xterm. Too bad. Perhaps changing the default value of `x-select-enable-primary' to t (and keeping `x-select-enable-clipboard' t by default) will help to avoid these problems. From unknown Mon Aug 18 15:39:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Jul 2012 08:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: 9563@debbugs.gnu.org Received: via spool by 9563-submit@debbugs.gnu.org id=B9563.134234199414392 (code B ref 9563); Sun, 15 Jul 2012 08:47:02 +0000 Received: (at 9563) by debbugs.gnu.org; 15 Jul 2012 08:46:34 +0000 Received: from localhost ([127.0.0.1]:41689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SqKTJ-0003k4-Or for submit@debbugs.gnu.org; Sun, 15 Jul 2012 04:46:34 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:40081 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SqKTG-0003js-JE for 9563@debbugs.gnu.org; Sun, 15 Jul 2012 04:46:31 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B486B451CB1F; Sun, 15 Jul 2012 01:40:41 -0700 (PDT) From: Juri Linkov Organization: JURTA References: <87y5xj89kv.fsf@mail.jurta.org> <87liin2jsl.fsf@gnu.org> <87a9z28zas.fsf@mail.jurta.org> Date: Sun, 15 Jul 2012 11:37:06 +0300 In-Reply-To: <87a9z28zas.fsf@mail.jurta.org> (Juri Linkov's message of "Sat, 14 Jul 2012 12:37:10 +0300") Message-ID: <878vel1l4k.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Perhaps changing the default value of `x-select-enable-primary' to t > (and keeping `x-select-enable-clipboard' t by default) > will help to avoid these problems. Oh no, I tried to enable both `x-select-enable-primary' and `x-select-enable-clipboard', and this breaks copy operations that become unusable. For instance, I select a region and type C-y to replace it with the text from the clipboard, but it inserts the same region back, instead of inserting text from the clipboard. Maybe this is a bug? From unknown Mon Aug 18 15:39:16 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jan 2018 21:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9563 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 9563@debbugs.gnu.org Received: via spool by 9563-submit@debbugs.gnu.org id=B9563.151717496317890 (code B ref 9563); Sun, 28 Jan 2018 21:30:02 +0000 Received: (at 9563) by debbugs.gnu.org; 28 Jan 2018 21:29:23 +0000 Received: from localhost ([127.0.0.1]:46817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1efuVu-0004eS-N0 for submit@debbugs.gnu.org; Sun, 28 Jan 2018 16:29:22 -0500 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:50447 helo=homiemail-a18.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1efuVt-0004eI-I8; Sun, 28 Jan 2018 16:29:22 -0500 Received: from homiemail-a18.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTP id 3608C258067; Sun, 28 Jan 2018 13:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jurta.org; h=from:to :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=jurta.org; bh=Y1PZESl Rp0vBHFy93df7U+vR474=; b=C8dJ0P6mnulrmNqj82kvtsUWoqH15z05dSFnGVE ET8J1ftFZKnC/KdKpJrC58DrY9suefd9ck8yMucUpzRmIKU/ylpwwmoDkDAzvjYL +568a8qTDulzQ4P0yRWFgymiivIs2a/kiEx+IFNDHTKuzFON3v3oD5QSrvzFX9s6 qC6s= Received: from localhost.linkov.net (m91-129-109-224.cust.tele2.ee [91.129.109.224]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTPSA id 5E94E258066; Sun, 28 Jan 2018 13:29:19 -0800 (PST) From: Juri Linkov Organization: LINKOV.NET References: <87y5xj89kv.fsf@mail.jurta.org> Date: Sun, 28 Jan 2018 23:14:36 +0200 In-Reply-To: <87y5xj89kv.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 20 Sep 2011 19:20:30 +0300") Message-ID: <87efmaw9d7.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) 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: 0.0 (/) tags 9563 wontfix close 9563 quit Sorry for leaving this report open for so long. I see nothing that could be done here. Whoever wants to sync clipboard with primary selection can customize =E2=80=98select-active-regions=E2=80=99 and =E2=80=98select-enable-primar= y=E2=80=99. Also it's possible in xterm to use =E2=80=98S-C-v=E2=80=99 instead of =E2= =80=98S-Insert=E2=80=99.