[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6774: Cut and paste with C-w/mouse-2 not working?

From: Kenichi Handa
Subject: bug#6774: Cut and paste with C-w/mouse-2 not working?
Date: Tue, 17 Aug 2010 10:44:59 +0900

In article <address@hidden>, Jan Djärv <address@hidden> writes:

> > We own the primary selection when mark is activated by C-@
> > in transient-mark-mode or C-@ C-@ not in
> > transient-mark-mode, and record somehow that selection is
> > owned that way (i.e. selection contents is a text in the
> > region).  At that time the contents is null, but I think
> > it's not the problem.  We do nothing special for all point
> > moving commands (except for highlighting the region).  When
> > Emacs receives selection request, it returns the text in the
> > region if the selection is still owned as the above way.  We
> > disown the selection when mark is deactivated.
> >

> I though we where moving away from special cases?  Anyway, empty selection do 
> matter.  Consider this case:

> I select a lot of code in another application.
> I go to Emacs and set mark, then paste the code with mouse-2 and then M-x 
> indent-region.

> With your scheme, mouse-2 would fail to paste, which would be a nasty 
> surprise.

Surely this is not good.  But which is a nastier surprise
for new users, your case or my case below:

>>>    (1) S-C-n
>>>    (2) C-@ C-n
>>> it's very confusing that they behave differently as to
>>> selection.

And, once we get used to that C-@ make Emacs own selection,
we'll do your task in this order: "Set mark in Emacs, select
a lot of code, paste it in Emacs, ...".

Or, we can have something like this single command (don't
take the code itself and the key-binding seriously).

(defun mouse-yank-primary-and-select (click)
  (interactive "e")
  (mouse-set-point click)
  (mouse-yank-primary click))

(global-set-key [S-C-mouse-2] 'mouse-yank-primary-and-select)

Though, please note that I myself still think it's better to
modify command_loop_1 than chaning C-@ to own selection.

Kenichi Handa

reply via email to

[Prev in Thread] Current Thread [Next in Thread]