diff options
Diffstat (limited to 'devdocs/elisp/yank-commands.html')
| -rw-r--r-- | devdocs/elisp/yank-commands.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/yank-commands.html b/devdocs/elisp/yank-commands.html new file mode 100644 index 00000000..c223c17c --- /dev/null +++ b/devdocs/elisp/yank-commands.html @@ -0,0 +1,18 @@ + <h4 class="subsection">Functions for Yanking</h4> <p>This section describes higher-level commands for yanking, which are intended primarily for the user but useful also in Lisp programs. Both <code>yank</code> and <code>yank-pop</code> honor the <code>yank-excluded-properties</code> variable and <code>yank-handler</code> text property (see <a href="yanking">Yanking</a>). </p> <dl> <dt id="yank">Command: <strong>yank</strong> <em>&optional arg</em> +</dt> <dd> + <p>This command inserts before point the text at the front of the kill ring. It sets the mark at the beginning of that text, using <code>push-mark</code> (see <a href="the-mark">The Mark</a>), and puts point at the end. </p> <p>If <var>arg</var> is a non-<code>nil</code> list (which occurs interactively when the user types <kbd>C-u</kbd> with no digits), then <code>yank</code> inserts the text as described above, but puts point before the yanked text and sets the mark after it. </p> <p>If <var>arg</var> is a number, then <code>yank</code> inserts the <var>arg</var>th most recently killed text—the <var>arg</var>th element of the kill ring list, counted cyclically from the front, which is considered the first element for this purpose. </p> <p><code>yank</code> does not alter the contents of the kill ring, unless it used text provided by another program, in which case it pushes that text onto the kill ring. However if <var>arg</var> is an integer different from one, it rotates the kill ring to place the yanked string at the front. </p> <p><code>yank</code> returns <code>nil</code>. </p> +</dd> +</dl> <dl> <dt id="yank-pop">Command: <strong>yank-pop</strong> <em>&optional arg</em> +</dt> <dd> +<p>When invoked immediately after a <code>yank</code> or another <code>yank-pop</code>, this command replaces the just-yanked entry from the kill ring with a different entry from the kill ring. When this command is invoked like that, the region contains text that was just inserted by another yank command. <code>yank-pop</code> deletes that text and inserts in its place a different piece of killed text. It does not add the deleted text to the kill ring, since it is already in the kill ring somewhere. It does however rotate the kill ring to place the newly yanked string at the front. </p> <p>If <var>arg</var> is <code>nil</code>, then the replacement text is the previous element of the kill ring. If <var>arg</var> is numeric, the replacement is the <var>arg</var>th previous kill. If <var>arg</var> is negative, a more recent kill is the replacement. </p> <p>The sequence of kills in the kill ring wraps around, so if <code>yank-pop</code> is invoked repeatedly and reaches the oldest kill, the one that comes after it is the newest one, and the one before the newest one is the oldest one. </p> <p>This command can also be invoked after a command that is not a yank command. In that case, it prompts in the minibuffer for a kill-ring entry, with completion, and uses the kill ring elements as the minibuffer history (see <a href="minibuffer-history">Minibuffer History</a>). This allows the user to interactively select one of the previous kills recorded in the kill ring. </p> <p>The return value is always <code>nil</code>. </p> +</dd> +</dl> <dl> <dt id="yank-undo-function">Variable: <strong>yank-undo-function</strong> +</dt> <dd> +<p>If this variable is non-<code>nil</code>, the function <code>yank-pop</code> uses its value instead of <code>delete-region</code> to delete the text inserted by the previous <code>yank</code> or <code>yank-pop</code> command. The value must be a function of two arguments, the start and end of the current region. </p> <p>The function <code>insert-for-yank</code> automatically sets this variable according to the <var>undo</var> element of the <code>yank-handler</code> text property, if there is one. </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/Yank-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Yank-Commands.html</a> + </p> +</div> |
