all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection
@ 2011-09-20 16:20 Juri Linkov
  2012-07-14  1:50 ` Chong Yidong
  2018-01-28 21:14 ` Juri Linkov
  0 siblings, 2 replies; 5+ messages in thread
From: Juri Linkov @ 2011-09-20 16:20 UTC (permalink / raw)
  To: 9563

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection
  2011-09-20 16:20 bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Juri Linkov
@ 2012-07-14  1:50 ` Chong Yidong
  2012-07-14  9:37   ` Juri Linkov
  2018-01-28 21:14 ` Juri Linkov
  1 sibling, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2012-07-14  1:50 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 9563

Juri Linkov <juri@jurta.org> 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).





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection
  2012-07-14  1:50 ` Chong Yidong
@ 2012-07-14  9:37   ` Juri Linkov
  2012-07-15  8:37     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2012-07-14  9:37 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 9563

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection
  2012-07-14  9:37   ` Juri Linkov
@ 2012-07-15  8:37     ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2012-07-15  8:37 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 9563

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection
  2011-09-20 16:20 bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Juri Linkov
  2012-07-14  1:50 ` Chong Yidong
@ 2018-01-28 21:14 ` Juri Linkov
  1 sibling, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2018-01-28 21:14 UTC (permalink / raw)
  To: 9563

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
‘select-active-regions’ and ‘select-enable-primary’.
Also it's possible in xterm to use ‘S-C-v’ instead of ‘S-Insert’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-28 21:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 16:20 bug#9563: dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection Juri Linkov
2012-07-14  1:50 ` Chong Yidong
2012-07-14  9:37   ` Juri Linkov
2012-07-15  8:37     ` Juri Linkov
2018-01-28 21:14 ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.