From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xue Fuqiao Newsgroups: gmane.emacs.help Subject: Re: About `current-kill' Date: Mon, 18 Mar 2013 16:24:59 +0800 Organization: The Church of Emacs Message-ID: <20130318162459.ac2588f3c4b5d65d92503526@gmail.com> References: <20130318063242.6b5a5f6e70e148cfdcede7fb@gmail.com> <87txo9mtj3.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1363595131 23684 80.91.229.3 (18 Mar 2013 08:25:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Mar 2013 08:25:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 18 09:25:53 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UHVOD-0000F9-Fm for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Mar 2013 09:25:53 +0100 Original-Received: from localhost ([::1]:32846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHVNq-0002KX-Gy for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Mar 2013 04:25:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHVNe-0002KN-8D for help-gnu-emacs@gnu.org; Mon, 18 Mar 2013 04:25:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHVNa-0003ap-Kv for help-gnu-emacs@gnu.org; Mon, 18 Mar 2013 04:25:18 -0400 Original-Received: from mail-da0-x236.google.com ([2607:f8b0:400e:c00::236]:36209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHVNa-0003aa-EX for help-gnu-emacs@gnu.org; Mon, 18 Mar 2013 04:25:14 -0400 Original-Received: by mail-da0-f54.google.com with SMTP id p1so1192178dad.27 for ; Mon, 18 Mar 2013 01:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:in-reply-to:references :organization:x-mailer:mime-version:content-type :content-transfer-encoding; bh=ZVEi14yvG963eoLXsgHwG1BK/RLL0oBv3F9+HGKMUiE=; b=ZcWLRdQIsGOIytn9zB8e6W39vvoCc1ZEFlOCcEjwXSvYSQHv03PTcNwh7BnznADcvs Xq1YAWplDDZHJdNL84HjM46kPcjP8KWhKxasia0pVGbOBdXwXjiAS1Hg4/C5vIRv47UG N070xkME1eQk2v7dKstrFVgfMm+gLUug1lUkg1sa/M+lXV8Mjch3iHLmuyI/+EEXX6p+ xbyii9g0wCBdbN28D8gBVQD9RONBtvrIRTNNj2Chttqs0TefUCindbP6lDDXu4lNmMf8 I8paK+UIqn6kmwdEx7Ux/rzMqgD7qCj4Zv2lmAnR9UKT3h+VHsFEzTKkG2wIEUrL9T4m XxmA== X-Received: by 10.66.248.227 with SMTP id yp3mr9087028pac.158.1363595113661; Mon, 18 Mar 2013 01:25:13 -0700 (PDT) Original-Received: from Emacs ([192.81.128.82]) by mx.google.com with ESMTPS id zm1sm19397275pbc.26.2013.03.18.01.25.10 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Mar 2013 01:25:12 -0700 (PDT) In-Reply-To: <87txo9mtj3.fsf@rosalinde.fritz.box> X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.13; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c00::236 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89575 Archived-At: On Mon, 18 Mar 2013 01:38:24 +0100 Stephen Berman 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/