aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert J. Chassell2006-10-31 18:04:34 +0000
committerRobert J. Chassell2006-10-31 18:04:34 +0000
commit70468157b399e6e06902dc031b388a9ef31bf6b2 (patch)
tree6aa2c5a4c6618d4eacbcae6cfe639dc2ac269776
parent7a01c129963f80d349ff71cb06bab9ce1fff6eac (diff)
downloademacs-70468157b399e6e06902dc031b388a9ef31bf6b2.tar.gz
emacs-70468157b399e6e06902dc031b388a9ef31bf6b2.zip
* eintr-2: updated `Introduction to Programming in Emacs Lisp'
-rw-r--r--info/eintr-2110
1 files changed, 47 insertions, 63 deletions
diff --git a/info/eintr-2 b/info/eintr-2
index d48cfc3c7d1..2b96d6e0c42 100644
--- a/info/eintr-2
+++ b/info/eintr-2
@@ -10,7 +10,7 @@ END-INFO-DIR-ENTRY
10This is an `Introduction to Programming in Emacs Lisp', for people who 10This is an `Introduction to Programming in Emacs Lisp', for people who
11are not programmers. 11are not programmers.
12 12
13Edition 3.00, 2006 Oct 31 13Edition 3.01, 2006 Oct 31
14 14
15Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2002, 15Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2002,
162003, 2004, 2005, 2006 Free Software Foundation, Inc. 162003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -39,6 +39,46 @@ this GNU Manual, like GNU software. Copies published by the Free
39Software Foundation raise funds for GNU development." 39Software Foundation raise funds for GNU development."
40 40
41 41
42File: eintr, Node: See variable current value, Next: defvar and asterisk, Prev: defvar, Up: defvar
43
44Seeing the Current Value of a Variable
45--------------------------------------
46
47You can see the current value of a variable, any variable, by using the
48`describe-variable' function, which is usually invoked by typing `C-h
49v'. If you type `C-h v' and then `kill-ring' (followed by <RET>) when
50prompted, you will see what is in your current kill ring--this may be
51quite a lot! Conversely, if you have been doing nothing this Emacs
52session except read this document, you may have nothing in it. Also,
53you will see the documentation for `kill-ring':
54
55 Documentation:
56 List of killed text sequences.
57 Since the kill ring is supposed to interact nicely with cut-and-paste
58 facilities offered by window systems, use of this variable should
59 interact nicely with `interprogram-cut-function' and
60 `interprogram-paste-function'. The functions `kill-new',
61 `kill-append', and `current-kill' are supposed to implement this
62 interaction; you may want to use them instead of manipulating the kill
63 ring directly.
64
65The kill ring is defined by a `defvar' in the following way:
66
67 (defvar kill-ring nil
68 "List of killed text sequences.
69 ...")
70
71In this variable definition, the variable is given an initial value of
72`nil', which makes sense, since if you have saved nothing, you want
73nothing back if you give a `yank' command. The documentation string is
74written just like the documentation string of a `defun'. As with the
75documentation string of the `defun', the first line of the
76documentation should be a complete sentence, since some commands, like
77`apropos', print only the first line of documentation. Succeeding
78lines should not be indented; otherwise they look odd when you use `C-h
79v' (`describe-variable').
80
81
42File: eintr, Node: defvar and asterisk, Prev: See variable current value, Up: defvar 82File: eintr, Node: defvar and asterisk, Prev: See variable current value, Up: defvar
43 83
448.5.1 `defvar' and an asterisk 848.5.1 `defvar' and an asterisk
@@ -6795,13 +6835,12 @@ characters, whitespace is added to fill out to this number. (Buffer
6795names can and often should be longer than 12 characters; this length 6835names can and often should be longer than 12 characters; this length
6796works well in a typical 80 column wide window.) 6836works well in a typical 80 column wide window.)
6797 6837
6798`:eval' was a new feature in GNU Emacs version 21. It says to evaluate 6838`:eval' says to evaluate the following form and use the result as a
6799the following form and use the result as a string to display. In this 6839string to display. In this case, the expression displays the first
6800case, the expression displays the first component of the full system 6840component of the full system name. The end of the first component is a
6801name. The end of the first component is a `.' (`period'), so I use the 6841`.' (`period'), so I use the `string-match' function to tell me the
6802`string-match' function to tell me the length of the first component. 6842length of the first component. The substring from the zeroth character
6803The substring from the zeroth character to that length is the name of 6843to that length is the name of the machine.
6804the machine.
6805 6844
6806This is the expression: 6845This is the expression:
6807 6846
@@ -7445,58 +7484,3 @@ To return to the old value for the length of the kill ring, evaluate:
7445* yank-pop:: 7484* yank-pop::
7446* ring file:: 7485* ring file::
7447 7486
7448
7449File: eintr, Node: current-kill, Next: yank, Prev: Kill Ring, Up: Kill Ring
7450
7451B.1 The `current-kill' Function
7452===============================
7453
7454The `current-kill' function changes the element in the kill ring to
7455which `kill-ring-yank-pointer' points. (Also, the `kill-new' function
7456sets `kill-ring-yank-pointer' to point to the latest element of the the
7457kill ring.)
7458
7459The `current-kill' function is used by `yank' and by `yank-pop'. Here
7460is the code for `current-kill':
7461
7462 (defun current-kill (n &optional do-not-move)
7463 "Rotate the yanking point by N places, and then return that kill.
7464 If N is zero, `interprogram-paste-function' is set, and calling it
7465 returns a string, then that string is added to the front of the
7466 kill ring and returned as the latest kill.
7467 If optional arg DO-NOT-MOVE is non-nil, then don't actually move the
7468 yanking point; just return the Nth kill forward."
7469 (let ((interprogram-paste (and (= n 0)
7470 interprogram-paste-function
7471 (funcall interprogram-paste-function))))
7472 (if interprogram-paste
7473 (progn
7474 ;; Disable the interprogram cut function when we add the new
7475 ;; text to the kill ring, so Emacs doesn't try to own the
7476 ;; selection, with identical text.
7477 (let ((interprogram-cut-function nil))
7478 (kill-new interprogram-paste))
7479 interprogram-paste)
7480 (or kill-ring (error "Kill ring is empty"))
7481 (let ((ARGth-kill-element
7482 (nthcdr (mod (- n (length kill-ring-yank-pointer))
7483 (length kill-ring))
7484 kill-ring)))
7485 (or do-not-move
7486 (setq kill-ring-yank-pointer ARGth-kill-element))
7487 (car ARGth-kill-element)))))
7488
7489In addition, the `kill-new' function sets `kill-ring-yank-pointer' to
7490the latest element of the the kill ring. And indirectly so does
7491`kill-append', since it calls `kill-new'. In addition, `kill-region'
7492and `kill-line' call the `kill-new' function.
7493
7494Here is the line in `kill-new', which is explained in *Note The
7495`kill-new' function: kill-new function.
7496
7497 (setq kill-ring-yank-pointer kill-ring)
7498
7499* Menu:
7500
7501* Understanding current-kill::
7502