[Top][All Lists]

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

RE: purpose and usage of secondary-selection ???

From: ken
Subject: RE: purpose and usage of secondary-selection ???
Date: Fri, 16 Sep 2016 14:31:04 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2

>/Sometimes while typing on my laptop I accidentally brush against the/
>/touchpad and inadvertantly mess up something. Today, while not even/
>/emacs, this happened, affecting what happened in an emacs frame which/
>/previously didn't even have the focus./
>/What I ended up in that emacs frame was that a random section of text/
>/was set to background yellow. Investigating further, I found that text/
>/with the yellow background was a secondary-selection. But I couldn't/
>/find anything in the Help screens describing anything about it, except/
>/its properties. So here are my questions:/
>/What is/are the purpose(s) of a secondary-selection?/
>/What can be done with a secondary-selection...? and how to do them?/
>/How do I undo this secondary-selection... i.e., make the selection go/
>/away without changing the file/buffer in any way?/

1. Emacs Wiki is your friend:

2. Its characteristics tell you its advantages and disadvantages.

a. It is separate from the region.  So you have two pieces of text you
    can paste/yank.

b. It is unrelated to point (the cursor position).  The region always has
    point as one of its end positions (mark is the other end).

3. A good use case: Selective replacement of things (same thing or
    different things) with the same text.  Select some text, then yank
    the secondary selection.  Repeat - anywhere; any text to replace.

    You cannot do this with the region text, because as soon as you
    select the text to replace you've redefined the region, and so
    also the text to yank.

4. For the secondary selection to really be useful, IMHO, you need to
    bind yanking it to a keyboard key, not just to a mouse action.

5. Library `second-sel.el' can help make the secondary selection
    more useful.

6. See the Emacs manual, node `Secondary Selection' for more info.

7. To make the secondary selection empty ("get rid of it"): Click
    `M-mouse-1' (don't drag).

Whoever thought of and whoever maintains the list archives, thanks. I found my post there, as well as two replies. Above is one which is very helpful. Thanks, Drew.

I'll be doing some reading on this and playing around with it. I like the fact that a secondary-selection's region is highlighted and that the highlighting doesn't follow the point around, that a region can be marked and *stays marked* while I move around within the file/buffer looking for something else, e.g., the place I want to move the region to. I hope to find other helpful uses for it.


PS (to developers): It would be nice if the emacs menus had some mention of secondary-selection, maybe some of its very basic functionality. Not a big fan of mousing around in text processors or editors, but sometimes a menu can give a clue when I don't have one. :)

reply via email to

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