emacs-devel
[Top][All Lists]
Advanced

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

Re: The X window system, yanking, and pasting using the mouse


From: Manoj Srivastava
Subject: Re: The X window system, yanking, and pasting using the mouse
Date: Thu, 27 Jan 2011 02:36:43 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) (x86_64-unknown-linux-gnu)

On Wed, Jan 26 2011, Eli Zaretskii wrote:

>> From: Manoj Srivastava <address@hidden>
>> Date: Wed, 26 Jan 2011 18:31:16 -0800
>> Mail-Copies-To: never
>> 
>>         In Emacs, I select text by:
>>  1) C-SPC (set-mark-command)  C-f C-f M-w (kill-ring-save)
>>  2) Down-mouse-1 drag-mouse-1 up-mouse-one (mouse-drag-region)
>>  3) Down-mouse-1 Down-mouse-3 (mouse-save-then-kill
>> 
>>         I would like each of these methods to copy things over so that a
>>  middle mouse click in an xterm to paste the text in the region.
>> 
>>         What changes do I need to make to get this?
>
> This is supposed to be explained in NEWS, under "Selection changes".
> It includes a paragraph on how to restore pre-Emacs 24 behavior.  If
> something is unclear or doesn't work as explained there, please submit
> specific bug reports.

        I'll bite.  I'll try to explain why the text below is confusing
 to me. So, the section starts of by saying mouse commands use the
 primary selection, all others use the clipboard. This is clear.

        The X windows application I am using as an example, xterm, sets
 and pastes from the primary selection. So my assumption was that the
 behaviour I want can thus be achieved by making everything just use the
 primary selection; this way when I select using the mouse in an xterm,
 which copies it to the primary selection, and then hit C-y, it will
 yank the primary selection. This was the old behaviour.

        Reading further, I can see that the new behaviour makes the
 Commands that kill text or copy it to the kill-ring (M-w, C-w, C-k,
 etc.) also put the killed text into the clipboard (apart from the kill
 ring). There is no way described to make them go back to just using the
 primary selection. Indeed, the last paragraph states that setting
 `mouse-drag-copy-region' and  `x-select-enable-primary' would make the
 mouse use the clipboard -- not what I want.

        However, the actual behaviour is different. With:
mouse-drag-copy-region    t
select-active-regions     nil
x-select-enable-clipboard t
x-select-enable-primary   t
|------------------------+---------+------|
| action                 | Primary | clip |
|------------------------+---------+------|
| Use M-w                | Set     | Set  |
| mouse drag in Emacs    | Set     | Set  |
| mouse-save-then-kill   | Set     | Set  |
|------------------------+---------+------|
| Mouse drag in Xterm    | Set     |      |
| left click/right click | Set     |      |
|------------------------+---------+------|

Flipping x-select-enable-clipboard to nil,
|------------------------+---------+------|
| action                 | Primary | clip |
|------------------------+---------+------|
| Use M-w                | Set     |      |
| mouse drag in Emacs    | Set     |      |
| mouse-save-then-kill   | Set     |      |
|------------------------+---------+------|
| Mouse drag in Xterm    | Set     |      |
| left click/right click | Set     |      |
|------------------------+---------+------|

        So the way to have everything just use the Primary selection
 (*NOT* the clipboard, one needs just set:
   (setq
         mouse-drag-copy-region    t
         select-active-regions     nil
         x-select-enable-clipboard nil
         x-select-enable-primary   t
   )


        If the following bit was clarified:
--8<---------------cut here---------------start------------->8---
**** `select-active-regions' now defaults to t.
It also accepts a new value, `only', which means to only set the
primary selection for temporarily active regions (usually made by
mouse-dragging or shift-selection).
--8<---------------cut here---------------end--------------->8---

        Does it mean:
a) temporarily active regions will only set primary selection (and not
   the clipboard), or
b) the primary selection is only set by temporarily active regions, and
   never else?

        In either case, this does not match my experience: even with
 select-active-regions nil the primary selection is being set (perhaps
 due to x-select-enable-primary and mouse-drag-copy-region set to t)

        Also, the final paragraph needs to be corrected:
--8<---------------cut here---------------start------------->8---
*** To return to the previous behavior, where mouse commands use the
clipboard, change `mouse-drag-copy-region' and (on X only)
`x-select-enable-primary' to t. 
--8<---------------cut here---------------end--------------->8---

        s/clipboard/primary selection/

        manoj


-- 
Wow, I'm being shot at from both sides.  That means I *must* be right.
:-) Larry Wall in <address@hidden>
Manoj Srivastava <address@hidden> <http://www.golden-gryphon.com/>  
4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20  05B6 CF48 9438 C577 9A1C




reply via email to

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