From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: lakerhy Newsgroups: gmane.emacs.help Subject: Re: non-continuous selection? Date: Sun, 1 Mar 2009 09:14:10 -0800 (PST) Organization: http://groups.google.com Message-ID: <315c0113-377f-43fc-b08d-1ceb8e172d94@w34g2000yqm.googlegroups.com> References: <6fa0ca5f-f67c-430a-bbd7-980a4da05db9@v19g2000yqn.googlegroups.com> <49AA9C52.9080800@web.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1235943013 589 80.91.229.12 (1 Mar 2009 21:30:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Mar 2009 21:30:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 01 22:31:30 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LdtFn-0005wI-4w for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Mar 2009 22:31:19 +0100 Original-Received: from localhost ([127.0.0.1]:57832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LdtES-0003uq-1A for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Mar 2009 16:29:56 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!w34g2000yqm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 47 Original-NNTP-Posting-Host: 82.211.197.37 Original-X-Trace: posting.google.com 1235927650 30200 127.0.0.1 (1 Mar 2009 17:14:10 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 1 Mar 2009 17:14:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w34g2000yqm.googlegroups.com; posting-host=82.211.197.37; posting-account=_QpW-goAAABBDVSqXYH-G5-bq4d7OgwL User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.63 (X11; Linux i686; U; Edition IBIS; en) Presto/2.1.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:167193 X-Mailman-Approved-At: Sun, 01 Mar 2009 16:27:24 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62501 Archived-At: On Mar 1, 3:31=A0pm, Marc Tfardy wrote: > lakerhy schrieb: > =A0> is there any method to get a non-continous selection? > =A0> > =A0> for example, if the text is as following: > =A0> > =A0> 123 > =A0> 456 > =A0> 789 > =A0> > =A0> I want to select 1 5 9 which is not continous or in a rectangle. How > =A0> this could be done? > > Do you want select "1", then "5" and then "9" and then paste all > together at one shot "159"? This small and simple function do this: > > (defun insert-collected-kill-ring (count) > =A0 =A0"Collect COUNT items from kill-ring and insert into buffer." > =A0 =A0(interactive "p") > =A0 =A0(if (>=3D (length kill-ring) count) > =A0 =A0 =A0 =A0(progn > =A0 =A0 =A0 =A0 =A0(let ((n (- count 1)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(str "")) > =A0 =A0 =A0 =A0 =A0 =A0(while (>=3D n 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0(setq str (concat str (substring-no-properties= (nth n > kill-ring)))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0(setq n (1- n))) > =A0 =A0 =A0 =A0 =A0 =A0(insert str))) > =A0 =A0 =A0(error "No enough items in kill-ring"))) > > You must select n piece of text, for each one do "copy" (M-w) and then > call insert-collected-kill-ring with numeric argument. For your example: > C-u 3 M-x insert-collected-kill-ring. > > Please note that this function inserts oldest first, but this is often > what one expect so you get "159" and not "951". > > HTH > > regards > Marc Thanks, this ring collection function do help at certain circumstances. But most of time, I would like to kill the non- continous at one stroke rather than one by one, just like the utility provided by ctrl in Windows.