[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About `current-kill'
From: |
Stephen Berman |
Subject: |
Re: About `current-kill' |
Date: |
Mon, 18 Mar 2013 01:38:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Mon, 18 Mar 2013 06:32:42 +0800 Xue Fuqiao <xfq.free@gmail.com> wrote:
> In the definition of the function `current-kill':
>
> [...]
> (let ((ARGth-kill-element
> (nthcdr (mod (- n (length kill-ring-yank-pointer))
> (length kill-ring))
> kill-ring)))
> [...]
>
> I understand what `ARGth-kill-element' does (from its name). But how
> does it work? I cannot understand it.
The kill-ring is a list of buffer substrings. As a ring, you can cycle
through it, e.g. if its length is 5, taking its cdr 8 times returns the
same result as taking its cdr 3 times; that's what the mod function
guarantees. So nthcdr skips over the first n elements of the kill-ring,
and the car of the resulting list becomes the current-kill.
Steve Berman