unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Bob Proulx <bob@proulx.com>
To: help-gnu-emacs@gnu.org, Robert Thorpe <rt@robertthorpeconsulting.com>
Cc: cplum984@gmail.com
Subject: Re: Need help with emacs clipboard.
Date: Fri, 30 Jan 2015 20:18:37 -0700	[thread overview]
Message-ID: <20150129185746715118144@bob.proulx.com> (raw)
In-Reply-To: <877fwah3p7.fsf@robertthorpeconsulting.com>

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

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

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
fixed.  Yay!

> If I mark something *and then "copy" or "cut" it*, then it enters the
> clipboard.

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

> So, when you do the Ctrl-C in the other app the x-selection and the
> clipboard contain the same information.

Yes.  Agreed.

> 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:
> https://code.google.com/p/chromium/issues/detail?id=68886

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.

Bob



  reply	other threads:[~2015-01-31  3:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  2:47 Need help with emacs clipboard cplum984
2015-01-14  4:46 ` Bob Proulx
2015-01-14 16:36   ` Harry Putnam
2015-01-14 20:46     ` Bob Proulx
2015-01-15 20:50       ` Harry Putnam
     [not found]       ` <mailman.17973.1421355042.1147.help-gnu-emacs@gnu.org>
2015-01-15 21:05         ` Joost Kremers
2015-01-25 22:53   ` Robert Thorpe
2015-01-31  3:18     ` Bob Proulx [this message]
2015-01-31 19:02       ` Robert Thorpe
2015-02-01  4:45         ` Bob Proulx
2015-02-01 13:53           ` Robert Thorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150129185746715118144@bob.proulx.com \
    --to=bob@proulx.com \
    --cc=cplum984@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rt@robertthorpeconsulting.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).