[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About `current-kill'
From: |
Xue Fuqiao |
Subject: |
Re: About `current-kill' |
Date: |
Mon, 18 Mar 2013 16:24:59 +0800 |
On Mon, 18 Mar 2013 01:38:24 +0100
Stephen Berman <stephen.berman@gmx.net> 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
That's what I've forgotten, thanks. It will be good if the {mark,kill}
ring uses ring.el, I think.
> 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.
That's true, and `(mod -3 5)' evaluates 2. It suits this feature exactly.
--
Xue Fuqiao
http://www.gnu.org/software/emacs/