From: Robert J. Chassell Date: Tue, 31 Oct 2006 18:05:16 +0000 (+0000) Subject: * eintr-3: updated `Introduction to Programming in Emacs Lisp' X-Git-Tag: emacs-pretest-22.0.91~421 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6c850af4a10e64f86433e554c801cbe3fcd337d1;p=emacs.git * eintr-3: updated `Introduction to Programming in Emacs Lisp' --- diff --git a/info/eintr-3 b/info/eintr-3 index 8c5b0583a43..c172f95a389 100644 --- a/info/eintr-3 +++ b/info/eintr-3 @@ -10,7 +10,7 @@ END-INFO-DIR-ENTRY This is an `Introduction to Programming in Emacs Lisp', for people who are not programmers. -Edition 3.00, 2006 Oct 31 +Edition 3.01, 2006 Oct 31 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -38,6 +38,61 @@ License". this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." + +File: eintr, Node: current-kill, Next: yank, Prev: Kill Ring, Up: Kill Ring + +B.1 The `current-kill' Function +=============================== + +The `current-kill' function changes the element in the kill ring to +which `kill-ring-yank-pointer' points. (Also, the `kill-new' function +sets `kill-ring-yank-pointer' to point to the latest element of the the +kill ring.) + +The `current-kill' function is used by `yank' and by `yank-pop'. Here +is the code for `current-kill': + + (defun current-kill (n &optional do-not-move) + "Rotate the yanking point by N places, and then return that kill. + If N is zero, `interprogram-paste-function' is set, and calling it + returns a string, then that string is added to the front of the + kill ring and returned as the latest kill. + If optional arg DO-NOT-MOVE is non-nil, then don't actually move the + yanking point; just return the Nth kill forward." + (let ((interprogram-paste (and (= n 0) + interprogram-paste-function + (funcall interprogram-paste-function)))) + (if interprogram-paste + (progn + ;; Disable the interprogram cut function when we add the new + ;; text to the kill ring, so Emacs doesn't try to own the + ;; selection, with identical text. + (let ((interprogram-cut-function nil)) + (kill-new interprogram-paste)) + interprogram-paste) + (or kill-ring (error "Kill ring is empty")) + (let ((ARGth-kill-element + (nthcdr (mod (- n (length kill-ring-yank-pointer)) + (length kill-ring)) + kill-ring))) + (or do-not-move + (setq kill-ring-yank-pointer ARGth-kill-element)) + (car ARGth-kill-element))))) + +In addition, the `kill-new' function sets `kill-ring-yank-pointer' to +the latest element of the the kill ring. And indirectly so does +`kill-append', since it calls `kill-new'. In addition, `kill-region' +and `kill-line' call the `kill-new' function. + +Here is the line in `kill-new', which is explained in *Note The +`kill-new' function: kill-new function. + + (setq kill-ring-yank-pointer kill-ring) + +* Menu: + +* Understanding current-kill:: +  File: eintr, Node: Understanding current-kill, Prev: current-kill, Up: current-kill @@ -2370,7 +2425,7 @@ Index * Else: else. (line 6) * Emacs version, choosing: Simple Extension. (line 37) * empty list defined: Lisp Atoms. (line 18) -* empty string defined: Review. (line 139) +* empty string defined: Review. (line 143) * eobp: fwd-para while. (line 59) * eq: Review. (line 113) * eq (example of use): last-command & this-command.