[Top][All Lists]

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

Re: non-continuous selection?

From: Marc Tfardy
Subject: Re: non-continuous selection?
Date: Sun, 01 Mar 2009 15:31:46 +0100
User-agent: Thunderbird (Windows/20081209)

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)
        (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".



reply via email to

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