[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help with emacs clipboard.
Re: Need help with emacs clipboard.
Fri, 30 Jan 2015 20:18:37 -0700
Robert Thorpe wrote:
> Bob Proulx writes:
> > I see exactly the opposite behavior. Emacs by default uses the
> > clipboard for cut-and-paste. But on my system nothing else uses the
> > clipboard as Firefox and Chromium both use the X primary selection.
> I think you're misunderstanding how things have changed. The idea of
> introducing the clipboard into X was to make things more like Windows.
> The old x-selection behaviour is still supported though.
I think you are misunderstanding my response. :-) But I agree with
you that the idea of the clipboard is more like MS-Windows.
I think the issue lies in the definitions of cut-n-paste. There are
at least three ways to perform those actions and the result expected
depends at least somewhat upon which way they are performed.
1. Click and hold mouse-1, drag, release. Text is highlighted and
placed into the primary selection. Click mouse-2. Primary selection
is pasted as input. Generally everywhere but in Emacs v24 this was
changed to use the clipboard by default instead of the primary selection.
2. Use an application that is configured for the Microsoft interface
such as pretty much any graphical browser these days. Highlight text
using mouse-1 click, drag, and release. Use C-c (or C-x) to copy (or
cut) the text into the clipboard. Paste using C-v.
3. Emacs graphical interface specifically interacts with the primary
selection and clipboard to place text killed with kill-region C-w and
kill-ring-save M-w into the primary selection in v23 and earlier or
into the clipboard in v24 and later. This is configurable using the
previously mentioned emacs configuration variables.
If you are a Microsoft type of person then you probably ignore #1 and
always use method #2 in which case you want emacs to interact with the
clipboard and therefore want the new v24 and later behavior. If you
are an X Window System type of person then you want to ignore #2 and
use #1 in which case you want Emacs v23 and earlier behavior not v24
> This is how things work on my system (Xubuntu). If I mark something
> with the mouse in Firefox, Thunderbird or Libreoffice then it enters the
> x-selection. If I then press the middle mouse button in Emacs it's
> pasted into the Emacs buffer. That's the old x-selection behaviour in
Yes. Agreed. Same here. Which is what I had said before. This
would be the interface that I define and describe as #1 above. This
is the way The X Window System works. Chromium, Firefox, Libreoffice,
others all behavior this way under The X Window System.
However I think something has changed again in Emacs v24. Because
with an earlier version middle mouse-2 paste would paste from the
clipboard by default (emacs -Q) which was much of my complaint but now
it is back to pasting from the primary selection. Something was
> If I mark something *and then "copy" or "cut" it*, then it enters the
I assume that when you say the "*and then ..." part you are talking
about using the Microsoft CUA keys C-w, C-x, C-v. That is what I
define and describe as #2 above. That is the way Microsoft works.
And by extension many X applications also support this because of the
many Microsoft refugees that arrive from there.
Note that in your words "If I mark something" that at that time it has
already been placed into the primary selection using the X Window
System behavior. You can immediately paste that with the mouse middle
button. When you then use C-c or C-x then that places it into the
clipboard using the Microsoft behavior.
> So, if I mark something and then press Ctrl-C in Libreoffice
> it enters the clipboard. Then I can press C-y in Emacs and it will yank.
Note that C-y in Emacs will reference the emacs configuration to paste
either from one or the other depending upon the variable settings. In
Emacs v23 and earlier a graphical emacs interface would paste from the
primary selection. In v24 and later it pastes from the clipboard by
> So, when you do the Ctrl-C in the other app the x-selection and the
> clipboard contain the same information.
> If I mark something different then the x-selection changes but the
> clipboard doesn't. This is actually useful because it means you can
> carry two independent bits of text from another app into Emacs without
> having to visit the app twice.
Yes. And let me applaud you for knowing this at that level of detail
and making use of it. Very good! I place that knowledge right there
with knowing about the kill-ring and being able to rotate through it.
Very useful knowledge. And mixed in there is also the secondary
selection too. See (apropos "mouse-.*-secondary") for a list.
> Apparently Chromium's behaviour is buggy though, see:
I don't see those issues every day but I have tripped over them on
occasion. Ashame that after several years and many releases those
issues are not fixed yet.