diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/internals-of-kill-ring.html | |
new repository
Diffstat (limited to 'devdocs/elisp/internals-of-kill-ring.html')
| -rw-r--r-- | devdocs/elisp/internals-of-kill-ring.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/devdocs/elisp/internals-of-kill-ring.html b/devdocs/elisp/internals-of-kill-ring.html new file mode 100644 index 00000000..9837d232 --- /dev/null +++ b/devdocs/elisp/internals-of-kill-ring.html @@ -0,0 +1,27 @@ + <h4 class="subsection">Internals of the Kill Ring</h4> <p>The variable <code>kill-ring</code> holds the kill ring contents, in the form of a list of strings. The most recent kill is always at the front of the list. </p> <p>The <code>kill-ring-yank-pointer</code> variable points to a link in the kill ring list, whose <small>CAR</small> is the text to yank next. We say it identifies the front of the ring. Moving <code>kill-ring-yank-pointer</code> to a different link is called <em>rotating the kill ring</em>. We call the kill ring a “ring” because the functions that move the yank pointer wrap around from the end of the list to the beginning, or vice-versa. Rotation of the kill ring is virtual; it does not change the value of <code>kill-ring</code>. </p> <p>Both <code>kill-ring</code> and <code>kill-ring-yank-pointer</code> are Lisp variables whose values are normally lists. The word “pointer” in the name of the <code>kill-ring-yank-pointer</code> indicates that the variable’s purpose is to identify one element of the list for use by the next yank command. </p> <p>The value of <code>kill-ring-yank-pointer</code> is always <code>eq</code> to one of the links in the kill ring list. The element it identifies is the <small>CAR</small> of that link. Kill commands, which change the kill ring, also set this variable to the value of <code>kill-ring</code>. The effect is to rotate the ring so that the newly killed text is at the front. </p> <p>Here is a diagram that shows the variable <code>kill-ring-yank-pointer</code> pointing to the second entry in the kill ring <code>("some text" "a +different piece of text" "yet older text")</code>. </p> <div class="example"> <pre class="example">kill-ring ---- kill-ring-yank-pointer + | | + | v + | --- --- --- --- --- --- + --> | | |------> | | |--> | | |--> nil + --- --- --- --- --- --- + | | | + | | | + | | -->"yet older text" + | | + | --> "a different piece of text" + | + --> "some text" +</pre> +</div> <p>This state of affairs might occur after <kbd>C-y</kbd> (<code>yank</code>) immediately followed by <kbd>M-y</kbd> (<code>yank-pop</code>). </p> <dl> <dt id="kill-ring">Variable: <strong>kill-ring</strong> +</dt> <dd><p>This variable holds the list of killed text sequences, most recently killed first. </p></dd> +</dl> <dl> <dt id="kill-ring-yank-pointer">Variable: <strong>kill-ring-yank-pointer</strong> +</dt> <dd><p>This variable’s value indicates which element of the kill ring is at the front of the ring for yanking. More precisely, the value is a tail of the value of <code>kill-ring</code>, and its <small>CAR</small> is the kill string that <kbd>C-y</kbd> should yank. </p></dd> +</dl> <dl> <dt id="kill-ring-max">User Option: <strong>kill-ring-max</strong> +</dt> <dd><p>The value of this variable is the maximum length to which the kill ring can grow, before elements are thrown away at the end. The default value for <code>kill-ring-max</code> is 60. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Internals-of-Kill-Ring.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Internals-of-Kill-Ring.html</a> + </p> +</div> |
