From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: purpose and usage of secondary-selection ??? Date: Tue, 13 Sep 2016 13:23:54 -0700 (PDT) Message-ID: <22657eef-7ce6-4df6-b8dd-f74eb0c5ca1c@default> References: <6a48016d-42bd-54ea-44c6-8dbf10fae885@mousecar.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1473798292 8738 195.159.176.226 (13 Sep 2016 20:24:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2016 20:24:52 +0000 (UTC) To: gebser@mousecar.com, GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 13 22:24:48 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjuFu-0008TH-8r for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 22:24:34 +0200 Original-Received: from localhost ([::1]:51447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuFq-0000hX-Ht for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Sep 2016 16:24:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuFR-0000hS-3R for help-gnu-emacs@gnu.org; Tue, 13 Sep 2016 16:24:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjuFM-000397-SW for help-gnu-emacs@gnu.org; Tue, 13 Sep 2016 16:24:04 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:33993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuFM-00038I-KD for help-gnu-emacs@gnu.org; Tue, 13 Sep 2016 16:24:00 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8DKNuFn030295 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Sep 2016 20:23:57 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8DKNu3s010775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Sep 2016 20:23:56 GMT Original-Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8DKNtSx021703; Tue, 13 Sep 2016 20:23:56 GMT In-Reply-To: <6a48016d-42bd-54ea-44c6-8dbf10fae885@mousecar.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6753.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111338 Archived-At: > 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. >=20 > 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: >=20 > What is/are the purpose(s) of a secondary-selection? >=20 > What can be done with a secondary-selection...? and how to do them? >=20 > 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: https://www.emacswiki.org/emacs/SecondarySelection 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. https://www.emacswiki.org/emacs/SecondarySelection#secondary-sel.el 6. See the Emacs manual, node `Secondary Selection' for more info. http://www.gnu.org/software/emacs/manual/html_node/emacs/Secondary-Selec= tion.html 7. To make the secondary selection empty ("get rid of it"): Click `M-mouse-1' (don't drag).