all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* non-continuous selection?
@ 2009-03-01 11:28 lakerhy
  2009-03-01 14:31 ` Marc Tfardy
  0 siblings, 1 reply; 4+ messages in thread
From: lakerhy @ 2009-03-01 11:28 UTC (permalink / raw)
  To: help-gnu-emacs

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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: non-continuous selection?
  2009-03-01 11:28 non-continuous selection? lakerhy
@ 2009-03-01 14:31 ` Marc Tfardy
  2009-03-01 17:14   ` lakerhy
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Tfardy @ 2009-03-01 14:31 UTC (permalink / raw)
  To: help-gnu-emacs

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

regards
Marc




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: non-continuous selection?
  2009-03-01 14:31 ` Marc Tfardy
@ 2009-03-01 17:14   ` lakerhy
  2009-03-01 18:03     ` Marc Tfardy
  0 siblings, 1 reply; 4+ messages in thread
From: lakerhy @ 2009-03-01 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 1, 3:31 pm, Marc Tfardy <m-t-o___CUT_...@web.de> 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
>
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: non-continuous selection?
  2009-03-01 17:14   ` lakerhy
@ 2009-03-01 18:03     ` Marc Tfardy
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Tfardy @ 2009-03-01 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

lakerhy schrieb:
> On Mar 1, 3:31 pm, Marc Tfardy <m-t-o___CUT_...@web.de> 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-01 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-01 11:28 non-continuous selection? lakerhy
2009-03-01 14:31 ` Marc Tfardy
2009-03-01 17:14   ` lakerhy
2009-03-01 18:03     ` Marc Tfardy

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.