From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marc Tfardy Newsgroups: gmane.emacs.help Subject: Re: non-continuous selection? Date: Sun, 01 Mar 2009 19:03:59 +0100 Message-ID: <71010hFi42v4U1@mid.individual.net> References: <6fa0ca5f-f67c-430a-bbd7-980a4da05db9@v19g2000yqn.googlegroups.com> <49AA9C52.9080800@web.de> <315c0113-377f-43fc-b08d-1ceb8e172d94@w34g2000yqm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1235932860 2518 80.91.229.12 (1 Mar 2009 18:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Mar 2009 18:41:00 +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 19:42:16 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 1Ldqbv-0001P3-Bw for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Mar 2009 19:41:59 +0100 Original-Received: from localhost ([127.0.0.1]:41658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ldqaa-00034D-Ac for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Mar 2009 13:40:36 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-X-Trace: individual.net 16t35dIl+WXlXNU172UeBAcEMdLO/pe8mKqU6b2U0tBBNlWVi5 Cancel-Lock: sha1:jN7/x58MAcvirqEVdSPuj375BwU= User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) In-Reply-To: <315c0113-377f-43fc-b08d-1ceb8e172d94@w34g2000yqm.googlegroups.com> Original-Xref: news.stanford.edu gnu.emacs.help:167197 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:62496 Archived-At: lakerhy schrieb: > On Mar 1, 3:31 pm, Marc Tfardy wrote: >> lakerhy schrieb: >> > is there any method to get a non-continous selection? >> > >> > for example, if the text is as following: >> > >> > 123 >> > 456 >> > 789 >> > >> > I want to select 1 5 9 which is not continous or in a rectangle. How >> > 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) >> "Collect COUNT items from kill-ring and insert into buffer." >> (interactive "p") >> (if (>= (length kill-ring) count) >> (progn >> (let ((n (- count 1)) >> (str "")) >> (while (>= n 0) >> (setq str (concat str (substring-no-properties (nth n >> kill-ring)))) >> (setq n (1- n))) >> (insert str))) >> (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 > 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. This works only with a mouse and mouse is probably not the first choise for emacs power user, but you can try the multi-region.el: http://www.ph.ed.ac.uk/~s0198183/multi-region.el This works without mouse. regards marc